How to create variables and insert them into formulas?


I would like to define several global variables in one central place, and then insert the values into concatenated texts in several tables, columns, etc… For example:

default color = blue
default country = USA
default city = Washington

Forexample, in Excel I would do this by naming a cell “default_color”, and then insert that name wherever I needed it.

How can I do this in Grist? Complete Grist/Python noob here… I read the Example of Global Variable, but I don’t really understand the explanation.

Hi @Tomas_Fransson.

Here’s an example you can check out: Grist

The Global table has a few columns, each containing a single cell whose value is a global variable (e.g. default_color). Then in Table1, those global variables are accessible in formulas via:

g = Global.lookupOne()
default_color = g.default_color

Think of g as being the first row of the Global table, with the values of each column accessible via g.column_name.