A virtual column is a column that doesn't correspond to an actual column in the underlying spreadsheet. Instead, it is automatically computed via an app formula expression. Virtual columns are computed columns. They are not actually persisted anywhere, so they won't show up in your spreadsheet once you create them. They do, however, impact your app, behaving much like an additional column.

Automatic Virtual Columns

Sometimes AppSheet will automatically create a virtual column based on your data. You can remove or edit these virtual columns in the same ways that you can modify virtual columns that you add manually.

How to Add a Virtual Column

To add a virtual column to a table, click the "+Virtual Column" under the Data > Column Structure tab. You can specify an appropriate formula expression; the type of the column is automatically detected by AppSheet. Typically, a virtual column uses the values of other columns in the same row.

Here are three common use cases for virtual columns:

  1. To combine other columns: in an app that captures a FirstName and a LastName, a virtual column with the formula CONCATENATE([LastName], ", ", [FirstName]) can be used to create a FullName.
  2. To construct conditional values: in an app that captures contact information, a virtual column called PreferredPhoneNumber may be defined with the formula IF([UseMobilePhone?],[MobilePhoneNumber],[PhoneNumber])
  3. To construct complex yes/no values: in an app that captures orders, a virtual column called Important? may be defined with the formula OR([Amount] > 1000,[Quantity] > 100)

The ability to create complex yes/no values is really important when they are used in other expressions like slice conditions and column constraints. In short, any time there is a need for a complex condition in an app, it is best to create a virtual column to represent the complex condition, and then use the virtual column wherever needed.

Editing the Order of Virtual Columns

As with regular, non-virtual columns, you can set the order from the table view definition. The option name is "Column Order".

Removing a Virtual Column

To delete virtual columns, just uncheck the checkbox in the bottom right hand corner of the edit column icon. It'll delete once you save your changes.

Did this answer your question?