Using the Table function
Sometimes you'll need to create the table manually. This might be to populate a Drop down control or to define information to be used in a Gallery or Data table control. To create a table, there's the Table function.
The Table function allows you to create a table of data that only exists in the context where it's created and used within your app. For example, to recreate the table shown in the previous section you can use the Table function in the Items property of a Data table. The formula would be as follows.
Table({Name: "Chocolate", Price: "$ 3.95", 'Quantity on Hand':
12, 'Quantity on Order': 10}, {Name: "Bread", Price: "$ 4.95",
'Quantity on Hand': 34, 'Quantity on Order': 0}, {Name: "Water",
Price: "$ 1.95", 'Quantity on Hand': 10, 'Quantity on Order':
10})
To see the items appear in the Table, be sure to update the Fields in the Properties panel. (Refer to the image above for location.) Select + Add field at the top, and then select the checkbox next to each of the field names to add.
Sometimes you need a simpler, single column Table for populating a Drop down control's choices. In this case, you can use the short cut method of [ ] to create a single column table. An example of creating a single column table with the colors Red, Blue, and Green is shown below.
["Red", "Blue", "Green"]
By placing that formula in the Items property of a Dropdown control, you'll have a simple dropdown with the three colors as options. The name of your single column will be Value. This is the same as if you had used the above formula and created a table like this: Table({Value: "Red"}, {Value: "Blue"}, {Value: "Green"}). As you can see, using [] for single column tables is much quicker and more efficient.