You can calculate new values from existing ones using expressions.
There are several places in the app editor where you can use expressions to affect your app's behavior and provide users with advanced functionality. Several AppSheet features use expressions, including: app formulas, column constraints, initial values, and virtual columns. The sample app, Quote Calculator, shows the use of various expressions in app formulas.
AppSheet checks all expressions to ensure they are correctly formed and being used in an appropriate manner. For example, if an expression is being used to assign an initial value to a column of type Number, AppSheet checks that the result of the expression is indeed a Number.
There are several different types of expressions that can be used within the app. When you're writing expressions in the app editor, you can use Expression Builder to help construct exactly what you need. When editing column definitions, you can use column constraints to control the behavior of the data in each column. You can also use deep links to access other apps and other views from a given column.
If you're familiar with spreadsheet formulas in Microsoft Excel or Google Sheets, you'll find AppSheet expressions similar in syntax and meaning. Although not an exact one-to-one match with AppSheet expressions, these Google Sheets functions may provide help with syntax.
The above shows where you can use expressions in the app editor.
An expression may be built with any combination of the following:
- Numbers: any whole numbers (integers) or real (floating-point) numbers, positive or negative.
- Dates & Times, enclosed in double quotes. Format dates as MM/DD/YYYY and times as HH:MM:SS. For example,
"10:15:00". Learn more about date and time expressions here.
- Text, enclosed in double quotes. For example,
Name any column using square brackets around the exact column name like this:
Once you've done this, you can use columns in expressions.
You can read about these different categories of functions in these articles:
- Date and Time Expressions
- Expressions for Working with Text
- Conditional Expressions
- Math expressions
- Yes/No Expressions
- List Expressions and Aggregates
- Other Functions
Watch this webinar to learn more about expression fundamentals: