Expressions may be used in various AppSheet features--app formulas, column constraints (Valid_If, Show_If, Required_If). initial values, and virtual columns--to customize app behavior and provide advanced functionality.

Expressions in this article align with the Other Expressions section of Expression Builder in the app editor.

Other expressions impact a range of scenarios and don't fit into any of the previous yes/no, math, time, columns, or list expression categories.

The function CONTEXT(option) returns a Text value that indicates where in the app this expression is being used. It's useful for "meta-data" operations and currently has limited functionality. There are currently only four allowed options: 

  • CONTEXT("Host") returns one of the following: "Browser", "Device", or "Server" to indicate where the expression is being evaluated. 
  • CONTEXT("View") returns the name of the current view or null if the expression is not run in the context of a view. 
  • CONTEXT("ViewType") returns the type of the current view (table, chart, map, etc) or null if the expression is not run in the context of a view.
  • CONTEXT(“AppName”) returns the current internal app name, e.g. “MyApp-1022822”

This function is often used with IN(). please see example of the combined use below.

IN(CONTEXT("ViewType"), {"Deck", "Gallery", "Table"})

answers the question: is the currently-displayed view's type Deck, Gallery, or Table? Equivalent to OR((CONTEXT("ViewType") = "Deck"), (CONTEXT("ViewType") = "Gallery"), (CONTEXT("ViewType") = "Table")). See also: IN().

See Also 

OR(), IN(), Other Expressions

Did this answer your question?