Not all data lives in data sources and, once in a while; it’s useful to generate a table of objects that lives in your App. Examples can be fill-in in dropdowns, have configuration data that only lives during your session, or have a way to refer back the changes that you made by keeping the values in a table.
One thing to keep in mind. A table can have multiple columns, and they are generated based on the union of all rows. For example, you can have one with names, addresses, and employee numbers so that the table will have 3 columns. If you don’t have a value in a row, the column will be created anyway if any row contains a value.
Usage
It follows a simple pattern.
- Element(s)
Example:
Table({Color:"red"}, {Color:"green"}, {Color:"blue"})
Color
red
green
blue
If you don’t want to use the Table Function, note that you can generate the values as follows:
["red","green","blue"]
The same rules apply to this notation using a Table function, but this will always create a single-column table.
Let’s check what happens when we don’t provide a value.
Table({Name:"Manuel", City:"Lisbon"}, {Name:"Jack"}, {Name:"John"})
Name City
Manuel Lisbon
Jack
John
As we mentioned before, the columns will be generated even if just one element has values.
Limitations
This won’t create a permanent table automatically, so if you want to store it, you need to store the data.
Recommendations:
- Use only for temporary actions or to keep data during the session. Anything else should be organized in its corresponding data source.
- You can use functions to add values. For example, you can have a column “Name” and the other the “Len” of the name.
- Save the table in a variable. It will be easier to move the values around your Power App.
- Don’t nest it. There’s no real reason to do it, but if you find yourself in a situation where you have nested Count functions in a formula, you should review it because something’s not right.
Sources:
Working with tables in Power Apps
Back to the Power Apps Function Reference
Photo by NMG Network on Unsplash