Comment on page
Custom app variables are used to store app state for a given instance of the app. For example, you might need to store a boolean value to track if a component is visible or not, or a datetime value for filtering recently created objects in a list.
App variables are runtime variables, which means that they exist only in the user's browser and are not saved to the database or shared with other users. An app variable will be cleared each time an app is refreshed, unless the Persistence property is populated.
You have a List component bound to a Tasks data source. You would like to only display uncompleted tasks by default, but you would like to add a Switch component to allow a user to also see completed tasks.
To solve this, you can add a custom app variable called
Show completed taskswith data type
Booleanand bind this variable to the Switch's Value property. Then you can add a Conditional Filter to the List with the Enabled property set to the conditional expression
App Variables.Show completed tasks NOT EQUALS trueand the Filter property with the filter expression
Tasks.Done NOT EQUALS true.
In this case the conditional filter will apply when the app is loaded, and show only uncompleted tasks, since
Show completed taskswill not have value. When a user toggles the switch, the conditional filter will be disabled and all tasks will display.
The built-in app variables contain standard information about an app while it's in use, such as the active environment or client screen size. Some of these variables are based on built-in enums which can be incorporated into your object classes.