A virtual column is a column that doesn't correspond to an actual column in the underlying spreadsheet. Instead, it is automatically computed using an app formula expression. Virtual column values are not actually stored anywhere, so they won't show up in your spreadsheet once you create them. They do, however, impact your app, behaving much like an ordinary column.
Here are three common use cases for virtual columns:
- To combine other columns: in an app that captures a
LastName, a virtual column could construct
FullNamewith the app formula,
CONCATENATE([LastName], ", ", [FirstName]). See also:
- To construct conditional values: in an app that captures contact information, a virtual column called
PreferredPhoneNumbermay be defined with the app formula,
IF([UseMobilePhone?], [MobilePhoneNumber], [PhoneNumber]). See also:
- To construct complex Yes/No values: in an app that captures orders, a virtual column named
Important?may be defined with the app formula,
OR(([Amount] > 1000.0), ([Quantity] > 100)). See also:
The ability to create complex
Yes/No values is really important when they are used in other expressions like column constraints and slice conditions. In short, any time there is a need for a complex condition in an app, it is often worthwhile to create a virtual column to represent the complex condition, then use the virtual column wherever needed.
The following sections describe how to use virtual columns:
- Add a virtual column
- Control the order of virtual columns
- Remove a virtual column
- Automatic virtual columns
To add a virtual column to a table, in the Data > Columns tab, click the Add Virtual Column button for the intended table:
Virtual columns occur in the table's column order after all non-virtual columns, in the order they were created. In the app editor, the color of the edit icon preceding a virtual column is different than that for a non-virtual column:
In detail, form, or table views, you have the option to set the column order. For instance, in a table view the column order is controlled by the Column order option:
Alternatively, you can create a slice with the desired column ordering.
To remove a virtual column, go to the column's configuration screen and click the Delete button
Note that the app editor will not prevent you from deleting a virtual column in use elsewhere in your app. After saving the change, the app editor may display errors noting references to the now-deleted virtual column. These errors will likely render your app unusable until the they are corrected.
Sometimes, AppSheet will add virtual columns automatically. Typically, these automatic virtual columns are added when a table is first added to the app, or when the table's structure is regenerated. These columns are typically added as a convenience based on common use. You may use, edit, or remove most system-added virtual columns as you see fit.
AppSheet also adds virtual columns to track reverse references. These virtual columns can be recognized by the following properties:
- The column name will begin with "Related", like
- The app formula will use the
- Column type
Listand element type
- Description text like "... entries that reference this entry in the ... column".
While the app editor will allow you to delete these columns, they will be recreated automatically the next time the app configuration is saved; there is no way to delete them permanently. Some reconfiguration of these columns is possible, though.