Examples

IN(CONTEXT("View"), LIST("Orders_Detail", "Orders_Form")) gives a Yes/No value that answers the question, is the currently-displayed view named Orders_Detail or Orders_Form? This might be used in a Show_If column constraint to display a column only in specific views but hide it elsewhere. See also: IN(), LIST().

("Form" = CONTEXT("ViewType")) gives a Yes/No value that answers the question, is the currently-displayed view a form view? This might be used in a Show_If column constraint to display a column only in form views but hide it elsewhere.

SWITCH(CONTEXT("Host"), "Device", "Tap below to:", "Browser", "Click below to:", "") gives different directions depending on whether the app is running from the native app on a device or from a browser. This might be used to generate a display name for a gallery view of launchers. See also: SWITCH().

Syntax

CONTEXT( option )

Arguments

  • option (Text): One of the following keywords: AppName, Device, Host, View, or ViewType. See Return Value below for descriptions.

Return Value

Text: A value reflecting the current running app. The value returned is determined by the option argument:

  • AppName: Gives the internal name of the app. For example, MyApp-123456.
  • Device: Gives a universally unique identifier (UUID) of the device, intended to identify the mobile device running the native app. Used from a browser, the UUID is tied to the browser's local storage, not the device itself, and may change if the browser's cache is cleared. In the emulator of the app editor, the value is randomly generated each time the editor is loaded or changes are saved.
  • Host: Gives Browser if the app is running in a browser, Device if a native app, or Server if used from an AppSheet server (e.g., in a workflow or report).
  • View: Gives the name of the view currently displayed to the user, or blank if no view is currently displayed (e.g., in a workflow or report).
  • ViewType: The view type of the view currently displayed to the user, or blank if no view is currently displayed (e.g., in a workflow or report).

See Also

HERE(), NOW(), USEREMAIL(), USERLOCALE(), USERNAME(), USERROLE()

Did this answer your question?