Data
Apps access and store data via data sources. Each app has access to some built-in data sources containing local variables and client information. You can also create your own data sources in order to create, read, update and delete objects in the database. Data sources are also used in services.
Built-in data sources include App variables for managing the state of your app, as well as others for accessing details of the current user and navigation state.
Creating your own data sources is how you expose the object classes you have defined in the Global data model to an app. A data source is populated with objects and you use dedicated action to nodes to interact with them.
Data sources
Your own data sources are a key element to every app. A data source is a window into the database where you can create, read, update, and delete objects. You can also create runtime data sources for working with data in a temporary state or calendars.
Data sourcesBuilt-in data sources
Every app has a number of built-in data sources. Practically every app will use App variables, but use of the others will depend on the specific functionality in your app.
App variables
App variables contain both built-in and custom variables that are used to hold global app state.
App variablesCurrent user
Current user is a effectively a single-cardinality data source based on the User object class. It contains the user object of the currently logged-in user. If you have configured unauthenticated access and a user is not logged in, this data source will be empty.
Current user roles
Current user roles contains a list of the roles in your solution as boolean properties. If an active user has been assigned a particular role, the property will be true. If they are not a member, the property will be false. This can be used for example, to restrict visibility to parts of the UI based on role.
Resource files
Resource files contains a list of the static files available to an app. This contains all items uploaded to Files.
URL parameters
URL parameters stores the available query parameters in an app. URL parameters are variables that can be included in the apps URL, such as search=appfarm
. You can create logic to check for parameters and run actions based on the values. A common use case is to create a deep link to specific object.
Example
You have a view that displays event details and you want to load that view and display an event according to the ID specified in a URL parameter when the app is loaded.
Create a URL parameter eventID
with the Data Type set as a reference to an Event
object class. Run an action using the On App Load event handler to check for the presence of a value in this parameter (an event ID). If there is a value, select that event in the Events
data source and navigate to the event details page.
You can then share a link to a specific event, such as https://thirty50.appfarm.app/events?eventID=63755d984575 and when a user clicks that link they will be taken directly to the details page for that event.
For more information about how to set this up, see How to create deep links.
Good to know
The first URL parameter included in a URL must be preceded with a question mark (?).
If you have a URL with multiple URL parameters, each parameter is joined with an ampersand (&).
For example:?eventID=63755d984575&showSimilarEvents=true
Property | Description |
---|---|
Key | The name of the parameter. The key must be unique among URL parameters and not contain any special characters. |
Data Type | The type of data allowed to be stored in this parameter. See data types. |
Description | A longer description of the URL parameter. For your own reference. |
URL path
URL path stores navigational state variables. It holds the end-users's currently active view and optionally the active subview if a view container is in use.
For example, if an end-user has navigated to https://thirty50.appfarm.app/events/my-events, the value of URL Path.View
would be my-events
.
Property | Data type | Description |
---|---|---|
View | Enum (View) | The end-user's currently active view. |
Subview | Enum (View) | The end-user's currently active subview, if a view container is in use. |
Last updated