# Importing values

If you find yourself using the same calculation repeatedly, Figures has some powerful features to help you work more efficiently. The first solution you can try is to define a variable or function to encapsulate the calculation you want. This lets you repeat a calculation as often as you need within the current sheet. However, if you have a calculation that you want to use in more than one sheet, it would be cumbersome to copy and paste the value into every sheet where it's needed.

Importing allows you to use values from another sheet as if they were defined locally. To import another sheet's values, use the word `import` followed by the name of a sheet. All the calculations that come after the import statement can now use the values from that other sheet.

Let's say you have a house-painting business and you've defined a function to help you estimate how much paint you need for a job. You use a different sheet for each job that includes the supplies estimates, proposal figures, payments, etc. Rather than copy the paint estimate function to a new sheet for every job, you define it in one place: a sheet we'll call `Paint Functions`:

``````// Paint Functions sheet
fun paint(height: wall height, lengths: wall lengths) {
wall areas = map(wall lengths, { #1 × wall height })
total area = total(wall areas)
return ceiling(total area / 250 ft²) gallons
}``````
``````

``````

You accept a job to paint the den in a new house, and you want to use the `paint` function. You create a new sheet for the job and add an import statement at the top:

``````import Paint Functions
paint(height: 9 ft, lengths: [10, 12, 5] as feet)``````
``````
2 gal``````

## Global Sheets

If you want to have access to values in any sheet in your document, you can create a "global sheet". A global sheet's values are available in every other sheet without needing to import them. To create a global sheet, you start by creating a regular sheet (see Organizing Sheets and Groups on how to do this). Then select `Editor > Add to Globals` in the menu bar. An icon will be displayed at the bottom of the window to indicate that the sheet is global.

NOTE

The values of global sheets are not available to other global sheets. If you want to access another sheet's values from a global sheet, import it explicitly.

## Member Operator

If a value with the same name is defined in different sheets, Figures will prefer the local one.

``````pi = 3
pi + pi``````
``````3
6``````

If you want to use a value from a specific sheet, you can use the member operator `.` to access it.

``````pi = 3
pi + Figures.pi``````
``````3
6.14``````

NOTE

Use `Figures` to access built-in values

The member operator works for functions as well.

``````total = 42
total += Figures.total(4, 8, 12)``````
``````42
66``````

Didn't find what you were looking for?