Appfarm Documentation
Getting startedDocumentationCommunityAppfarm Create
  • Overview
  • Getting Started
    • What is Appfarm?
    • Key concepts
    • Quickstart
      • Speed intro
      • Step-by-step guide
    • Appfarm Showroom
    • FAQ
  • Appcademy
    • Learning paths
    • Appfarm Fundamentals
      • Intro Course
        • 1. Intro to No-Code and Appfarm
        • 2. Navigation in Appfarm Create
        • 3. What is Apps?
        • 4. Intro to UI Editor
        • 5. Data Model
        • 6. App Data
        • 7. Actions
        • 8. Tips and Tricks
        • 9. Intro to practical walkthrough
        • 10. Create a details view of a Project
        • 11. Create a Custom List
        • 12. Swipe and Delete
        • 13. Functionality for simple Create of Data
        • 14. Upload and Download Photos
        • 15. Input Dialog with Validation and Save
        • 16. Dashboard
        • 17. Summary
        • Quiz
      • User Interface Fundamentals
        • Container - Sectioning, Styling and Repeating
        • Conditional Styles
        • Motions
        • Responsive Design
        • Step-by-step workflow
        • Featured UI Components
        • Quiz
      • App Data Fundamentals
        • Data Source Filtering
        • App Variables and Runtime Properties
        • URL Parameters
        • Quiz
      • Actions & Logic Fundamentals
        • Event Handlers
        • Featured Action Nodes
        • Context Parameters
        • Quiz
      • Services Fundamentals
        • Introduction to Services
        • Setting up a Service
        • Scheduling a Service
      • Integration Fundamentals
        • The web request action node
        • Fetch data from an endpoint
        • Map data to a data source
        • Modify the response
        • Nested data mapping
        • Path parameters
        • Authentication
        • Send data to an endpoint
        • Quiz
      • User handling and permissions
        • Users and roles
        • Permissions
        • Creating users
        • Extending the User object class
        • Updating and deleting users
        • Unauthenticated access
        • Quiz
    • Appfarm Professional
      • User Interfaces
        • Featured UI Components
        • Concepts and Use Cases
      • Data Structures & Data Handling
        • Data Features
        • Search & Filters
        • Featured Action Nodes
        • GraphQL
      • Logic & Flow
        • Logical Concepts
        • Date and Time Handling
        • Featured Action Nodes
        • Exception Handling
      • Login & Configuration
        • Login and Authentication
        • Settings, Configuration and Languages
      • Security & Operations
        • Security and Permissions
        • Deployment
        • Schedules and Logs
        • Debugging and App Health
      • Performance & Optimization
        • Optimizing Performance
        • Enhancing Functionality
    • Appfarm Sales Representative
    • Appfarm Developer Forum
      • Session 1: Data Modeling in Appfarm Create
      • Session 2: App Data in Appfarm Create
      • Session 3: Services in Appfarm Create
      • Session 4: Optimizing Performance
    • Background
      • Databases
        • Data modeling 101
        • Database normalization
  • Library
    • UI components
      • Advanced bar chart
      • Advanced bubble chart
      • Advanced combined chart
      • Advanced gantt chart
      • Advanced heatmap chart
      • Advanced line/area chart
      • Advanced pie chart
      • Advanced scatter plot chart
      • Advanced solid gauge chart
      • Animated component
      • Avatar
      • Avatar group
      • Basic bar chart
      • Basic gauge chart
      • Basic line chart
      • Basic pie chart
      • Bottom navigation
      • Button
      • Checkbox
      • Chip group
      • Circular progress
      • Coded component
      • Container
      • Date & time picker
      • Drawable canvas
      • Floating action button
      • Icon
      • Icon button
      • Iframe
      • Image
      • Linear progress
      • List
      • Map
      • Menu list
      • Multi select
      • PDF reader
      • Popover
      • Radio buttons
      • Rich text editor
      • Rich text
      • Select
      • Slider
      • Speed dial
      • Switch
      • Table
      • Tabs
      • Text
      • Text edit
      • View container
      • Visibility group
    • Action nodes
      • Aggregate data
      • Advanced search
      • Auth operations
      • Block
      • Catch exception
      • Copy to clipboard
      • Create file archive
      • Create file object
      • Create object
      • Create user account
      • Delete objects
      • Delete user account
      • Duplicate objects
      • End execution
      • Exit block
      • Exit loop
      • Export data
      • Foreach
      • Generate document
      • If
      • Import data
      • Invalidate cache
      • Log in
      • Log to console
      • Log out
      • Next iteration
      • Navigate
      • Open/close popover
      • Open confirm dialog
      • Open print dialog
      • Open snackbar
      • Open Unsplash dialog
      • Open URL
      • Persist objects
      • Push notifications
      • Read objects
      • Request permissions
      • Run code
      • Run other action
      • Run service
      • Scan barcode/QR code
      • Send email
      • Send SMS
      • Set client language
      • Set data source attributes
      • Set selection
      • Set theme
      • Set user account image
      • Show install app prompt
      • Sleep
      • Sort objects
      • Throw exception
      • Toggle drawer
      • Update object
      • Update secret
      • Update user account
      • Web request
      • While
  • Reference
    • Appfarm Create
      • Appfarm Commander
      • Blue dots
      • Copy & Paste
      • Farmer's Market
      • Find references
      • Find usage
      • Keyboard shortcuts
      • Undo/Redo
      • User preferences
    • Platform concepts
      • Conditions
      • Data bindings
      • Date and time
      • Event handlers
      • Filters
      • Functions
      • Markdown
      • Objects
      • Operators
      • Value processor
    • Dashboard
    • Apps
      • UI
        • Views
          • Dialog
          • Drawer
        • Layout designer
        • Component properties
        • Shareable UI components
      • Data
        • App variables
        • Data sources
        • Calendar data sources
      • Actions
      • App settings
      • App size
      • App health
    • Services
      • Service Endpoints
      • Service settings
      • Service health
      • API explorer
    • Data model
      • Object classes
      • Object class properties
      • Enumerated types
      • GraphQL
        • Queries
        • Mutations
      • Data Extract API
      • Time series data
    • Operations
      • Deploy
      • Schedules
      • Logs
    • Resources
      • Themes
      • Files
      • Fonts
      • Internationalization
    • Configuration
      • Environments
      • Login
        • Custom auth providers
    • Security
      • Users
      • Service accounts
      • Roles
      • Secrets
      • Permissions
        • Conditional Permissions
    • Appfarm Client
      • Developer tools for Apps
      • Developer tools for Services
      • Warnings and errors
  • How to
    • Data modeling
      • Many-to-many relationships
      • Use naming conventions
      • Offline data handling
      • Data silos and White labelling
    • User interface
      • Manage a many-to-many relationship with a Chip group
      • Configure drag and drop
      • Build a drag-and-drop calendar
      • Design a responsive layout
      • Work with flexbox
      • Use Mapbox as a map layer
      • Understand charts
    • Logic and flow
      • Event Log Design
      • Configure advanced search
    • Themes and styling
      • Change the active theme
      • Add custom email templates
    • Enhance your app
      • Add deep links
      • Add keyboard shortcuts
      • Add link previews for social media
      • Apply SEO best practices
      • Change the active language
      • Generate a PDF from a Container
    • Integrations
      • Integrate with external systems
      • Integrate with OpenAI
      • Integrate with Google Analytics (GA4)
      • Configure a custom email account
      • Integrate with a payment provider
      • Integrate with Signicat
      • Integrate directly with an external database
      • Retrieve a Bearer token from Google Cloud
      • Fetch data from BigQuery
      • Retrieve access token from Microsoft Entra ID
    • Workflow automation
      • Update an OAuth 2.0 access token from a service
    • Authentication and access control
      • Add users and assign roles
      • Configure unauthenticated access
      • Implement third-party authentication
    • Security, testing and deployment
      • Add a custom domain
      • Install an app on a device
      • Get ready for Production
      • Optimize performance
      • Security checklist
      • Test and debug
    • Example apps
      • Create an Instagram clone
        • The end result
        • Designing the feed
        • Create new post
        • Add a like-button
        • Add comment-functionality
  • Solution administration
    • Subscription and billing
    • Dedicated tier benefits
    • Guide to GDPR
      • Key principles
      • How Appfarm protects personal data
      • How you can protect your clients’ data
      • Glossary
    • Appfarm and the EU AI Act
  • Policies
    • Appfarm Policies
    • Data Processors
    • Privacy Policy
Powered by GitBook
On this page
  • Database-connected and runtime-only data sources
  • Data connectors
  • Calendar data sources
  • Enum data sources
  • Usage
  • General properties
  • Client filters
  • Remarks regarding Read All Objects & Client Filters
  • Sorting
  • Reference data sources
  • Runtime properties
  • Object class properties
  • Data source object properties
  • Data source attributes

Was this helpful?

Export as PDF
  1. Reference
  2. Apps
  3. Data

Data sources

PreviousApp variablesNextCalendar data sources

Last updated 2 months ago

Was this helpful?

The data sources you add to an app serve as storage. An object class data source is based on an defined in the . It can be , where the contained objects are a direct representation of the data read from the database. A data source can also be , allowing you to work with objects in a temporary state before storing them in the database. For bulk operations, you might need which offer more efficient direct access to the database.

Other types of data sources are also available, for and . There are also a number of in every app.

Database-connected and runtime-only data sources

Apps use primarily two types of object class data sources, database-connected and runtime-only. In general, database-connected data sources are used when you need to read data directly from the database, while runtime-only data sources are used as temporary storage to create and edit objects before they are saved to the database.

By default, an object class data source is database connected. A selection of objects are automatically read into the database according to the Filter property (or all objects if Read All Objects is selected) and the data source will continuously monitor this . Objects created, updated, and deleted in the data source are persisted immediately.

Good to know

If you create a new object in a database-connected data source, and the new object does not qualify for the data source according to the filter, the object will be created and persisted, but will not be present in the data source.

However, if you want to work with data in a temporary state you can use a runtime-only data source. This can be useful for importing data or storing edits before saving the changes to the database. A data source is made runtime-only by selecting Runtime Only in the .

Objects can be created, read, updated, and removed from runtime-only data sources, but these operations must be done explicitly using action nodes. One exception is creating objects, which can be made automatic in single-cardinality data sources by selecting Auto Create in the data source properties. When auto create is enabled, a new object will be created in the data source on app load and when the data source is emptied by removing an object. To save a new or updated objected to the database, you must use the .

Good to know

If you delete a persisted object from a runtime-only data source it only removes the object from the data source. It will not be deleted from the database.

Runtime-only data sources are quite performant as they are not continuously communicating with the database. It is recommended to use runtime-only data sources to manage objects when possible, particularly when performing data modifications in iterations. See for more information.

Data connectors

An object class data source configured as a data connector has a direct connection to the database. Data connectors are useful for performing bulk data manipulation operations directly towards the database without having to read or keep the data in the data source.

As no objects are actually contained in the data source, it can’t be used to display data in the UI. However, you can use the , , and action nodes with the data source to manipulate the data.

Good to know

Changes to data which happen through Data Connectors (e.g. creates, updates, deletes) will not trigger Subscribe to Updates functionality.

Calendar data sources

A calendar data source is a special type of data source for working with time periods. A typical use case for a calendar data source is when you need to iterate over a number of time periods, for example all the months of a year, or every hour of a day. You might do this to group data by time period, for example all orders placed in a given month.

Enum data sources

Example: Filter by event type

On the list, you can add a conditional filter which is enabled if Event type.Has selected objects EQUALS true and a filter Events.Event type = Event type (Context/Selected).

You could also add a conditional property to the chip group, setting a new color if the Event type.Is Selected EQUALS true.

Usage

To add an object class data source to an app:

  • Open the app and navigate to Data.

  • In the App Data panel, click the + icon.

  • Select one or more object classes for which you'd like to create data sources.

  • Click Add.

To add an enum data source to an app:

  • Open the app and navigate to Data.

  • In the App Data panel, click the down arrow icon.

  • Select Add Enum Data Source.

  • Select one or more enums for which you'd like to create data sources.

  • Click Add.

General properties

Property
Description

Name

A descriptive name for the data source. Use the singular for single-cardinality data sources and plural for many-cardinality data sources. For runtime data sources, you might like to add (runtime) or (temp) to the end of the name for quick identification.

Object Class

Read only. The object class the data source is based on.

Cardinality

Whether the database can hold one or many objects.

A data source of cardinality one is often used in conjunction with Runtime Only for creating new objects, or to store an object while it is being edited.

Cardinality many is useful when you want to access to a group of objects, for example to bind to a List or Table component, or to import rows from a CSV file. If this property is set to One, it will be indicated in the data source's icon in lists of data sources.

Filter

A data source can be filtered on another data source. If you have two data sources Projects and Tasks, you can add a filter to Tasks such as Task.Project EXISTS IN Projects. Only tasks with a reference to one of the objects contained in Projects will be populated. Most data sources should have a filter, for both security and performance reasons. A data source should only contain the objects a user should be allowed to see given their role. Additionally, too many objects will degrade app performance.

Read All Objects

Populate the data source with all objects in this Object Class. Selecting this option will result in a warning, see Filter above.

Client Filters

Sorting

Initially Skip Object Count

Initially Limit Object Count

Data Connector

When selected, no data will be read into the data source. The data source will instead operate as a direct connection to the database.

Runtime Only

Deleting an object from a runtime data source will only remove the object from the data source. It will not be deleted from the database.

Auto Create

Available for single-cardinality runtime-only data sources. When selected, a new object will be created in the data source on app load and when the data source is emptied by removing an object.

Initially Subscribe to Updates

Initially Disabled

The data source will be disabled when the app is loaded and as a consequence will be empty.

Reference Data Sources

Description

A longer description of the data source. For your own reference.

Client filters

Add one or more filters to a data source that can be enabled or disabled at runtime. This is useful if you want to provide a user with the ability to filter data from the UI. Client filters are applied in addition to one specified in the Filter property.

For example, say you have a data source Projects, where each project has a status of either New, Ongoing, or Complete. You can display the projects in a list and add UI components to enable the user to dynamically filter the data source (and thereby the list) to contain only the projects with a specific status.

One advantage to using client filters on a data source over conditional filters on a UI component is that you can easily access the Object Count If this property is selected, it will be indicated in the data source's icon in lists of data sources.

Property
Description

Name

A reference for the filter.

Enabled

Set the filter to be enabled according to a data binding, condition, or function.

Filter

Remarks regarding Read All Objects & Client Filters

Using Read All Objects or Client Filters may not align with security best practices. Client Filters are applied after the data has been transmitted from the server. This means that some browser developer tools can inspect the unfiltered data as it is transmitted from the server to the client. Likewise, datasources with Read All Object will also be available for inspection in some browser developer tools. This is important to keep in mind when filtering data on the client, either in form of Client Filters or UI filters.

Sorting

Apply one or more sorting rules to a data source that will be continuously applied. If multiple rules are added, they will be applied from the top down.

Good to know

Property
Description

Sort Field

Sort Order

Whether the sort should be ascending or descending. Ascending will sort numbers from smallest to largest and strings from A–Z. Descending will sort in the opposite direction.

Reference data sources

If you have an object class property which references another object class, and your app accesses a property in the referenced object class, this is known as a deep-data binding. If you add a reference to a runtime-only data source, this deep-data binding will not be available unless the object is persisted.

By adding a reference data source you explicitly specify a data source that contains the data for the referenced object class. This solves the issues above by removing the need for a generated data source and enabling deep-data bindings on non-persisted references.

Example: Customers and Contacts

You two data sources, Contacts and Customers. Contacts has an object class property Customer, which is a reference to the Customer object class. In a Table component listing all contacts, you want to display the customer name. If you add Contacts.Customer.Name as a column in the table, this would create a generated data source joining the contact and customer data.

Since you already have the Customers data source, you can add a reference data source with Reference Customer and Data Source Customers. With the reference data source enabled, the customer data is now read from the Customers data source. You can add any property from the Customer reference, such as Contacts.Customer.Country without any performance impact.

Property
Description

Reference

The referenced object class.

Data Source

The data source that contains the data for the referenced object class.

Runtime properties

Runtime properties are data-source specific custom properties available for each object in the data source. The value of a runtime property will exist only in the user's browser and is not saved to the database or shared with other users. A typical use case is to calculate a value based on other properties.

Example: Function to calculate a total

You have a data source based on the object class Order line that includes the object class properties Quantity and Price. You want to automatically calculate the total in your app.

Create a runtime property Total, with Data Type Float and Property Type Function. Create a function that multiplies the quantity property by the price quality and returns the total.

You can then reference the Total property in your UI and it will dynamically update when Quantity and Price are changed.

Property
Description

Name

The name used throughout Appfarm Create to refer to this property. This name can be changed at any time without technical consequences.

Node Name

The key that is used to store the property in memory.

Description

A longer description of the property. For your own reference.

Data Type

Cardinality

Property Type

An runtime property can be either a value or a function.

  • Value: A primitive value that can be read and updated.

Value on Create

Available for Value property type. A default value to set for the property when the app is loaded.

Function

Object class properties

Data source object properties

Property
Data type
Description

Index

Integer

Is Even In Data Source

Boolean

The Index of the object is an even number.

Is First In Data Source

Boolean

The object has an Index of 0.

Is Last In Data Source

Boolean

The object has the highest index of all objects.

Is Not Selected

Boolean

Is Selected

Boolean

Object State

Boolean

Available for runtime-only data sources. The persist state of the object. An object will return one of the following values:

  • New: The object has never been persisted to the database.

  • Updated: The object exists in the database, but has changes that have not been persisted.

  • Synchronized: Any changes have been persisted and the object is in sync with the database.

Data source attributes

Example: Skip objects

You have created a custom list with all objects in a Customers data source using iterating containers. You'd like to add pagination, displaying 10 objects at a time.

Set Initially Limit Object Count to 10 and Initially Skip Object Count to 0. Add a Next page button that triggers an action with the Set data source attributes action node and increase Skip by 10.

Example: Limit objects

You have created a custom list of objects in an Events data source using iterating containers. You would like to implement dynamic loading of data, known as infinity scrolling.

Set Initially Limit Object Count to 20. Add a Load more button at the bottom of the custom list that triggers an action with the Set data source attributes action node and increase Limit by 20.

Property
Data type
Description

Data Ready

Boolean

Disabled

Boolean

Has No Selected Objects

Boolean

Has Selected Objects

Boolean

Is Empty

Boolean

The data source contains no objects.

Is Not Empty

Boolean

The data source contains at least one object.

Limit

Integer

Object Count

Integer

The number of objects in the data source.

Selected Objects Count

Integer

Skip

Integer

Subscribe To Updates

Boolean

Total Objects Count

Integer

The total number of objects that qualify for the data source. This number may differ from Object Count because it includes objects excluded from the data source due to Client Filters, Limit, and Skip.

For example, with an Orders data source as a data connector, you could use the to set Order.Status to Active for a filtered selection on Orders where Order.Status HAS NO VALUE. All orders in the database without a status will be updated immediately.

An enum data source is a way to directly expose an that's made directly available to an app. This can be useful for filtering data in the UI based on multiple enum values, using the Chip group or components.

You have a view with a List component containing Events and you want to allow users to select one or more Event type values (an enum added as a property to the Event object class) and view only events matching the types.

You can add the Event type enum as an enum data source and bind it to a Chip group component. Then you can attach an action to the chip group's On Click event handler which runs a with Operation Type Toggle selection.

By default the data source will be . You can configure it to be a or .

Create a to restrict which objects are read into the data source from the database. The data source will continuously evaluate this filter. If an object is changed and no longer meets the criteria, it will be removed from the data source.

Add .

Add .

The number of objects to skip when objects are first read into the data source. For example, if Skip is set to 2, the first 2 objects in the database that would normally qualify for the data source are ignored. This number can be altered at runtime using the .

The maximum number of objects to read into the data source on first read. This number can be altered at runtime using the .

This allows you to do bulk directly towards the database without having to read or keep the data in the data source.

When selected, no data in this data source will be stored in the database unless a is run.

The data source will update when a change is made by another user. This means a refresh is not required to see changes made by others to the objects you are viewing. this should only be used when necessary, because it may have a performance impact. If this property is selected, it will be indicated in the data source's icon in lists of data sources. This property can be altered later using the . Important notes: - We do not recommend using Subscribe to Updates as the only concurrency or data-refresh mechanism for applications with critical needs for instant live sync between clients. For example, if the main feature of your app is that data is instantly live in all clients, such as in a booking system or a multi-user quiz app, you cannot only rely on Subscribe to updates, since the feature does not have a 100% delivery guarantee. - When objects are updated through , the changes are not pushed to Data Sources with Initially Subscribe to Updates. - When objects are updated through a Data Connector Data Source (see info about Data Connector a few rows above), the changes are not pushed to Data Sources with Initially Subscribe to Updates. - If (with conditional read-permissions) have been set up for an Object Class, Initially Subscribe to Update will not work for Data Sources of that Object Class.

This can be used for performance optimization by lazy loading data. For example, if you have a data source Company Log and you only need this data when the user clicks a View History button, you can have the data source initially disabled and enable it if the user clicks the button. This property can be altered at runtime using the .

Add .

The that should apply if Enabled equates to true.

The most secure approach is to use standard on a data source or . These filters are evaluated on the and prevent unauthorized data from being transmitted.

Sorting applied directly on a data source can not be used on conjunction with the .

An to sort on.

Specify which data source contains the data for a in the object class.

Reference data sources allow you to use deep-data bindings for non-persisted references and runtime function references. They are helpful for creating REST-heavy applications and are also an important element for in larger apps.

If you are interacting with a persisted object, a generated data source is created in the background, joining the two object classes. This can result in large amounts of extra data being loaded into an app. In the Developer Tools, you may turn on display of these data sources by enabling .

The type of data allowed to be stored in this property. See .

If the Data Type is set to a reference to an Object Class or an Enumerated Type, you have the option to define Cardinality. The default is One, but you may also select Many (storing an array of references instead of a single reference). Read more on the Cardinality setting in the Object Class Properties section .

Function: A that calculates a value at runtime. For example, a function that multiplies the values of two other properties and returns a total. If the properties change, the function will re-run.

Available for Function property type. A that calculates and returns a value at runtime.

Object class properties are the properties you have defined for the in the , as well as .

Data source object properties are built-in properties available for each in the data source.

The index (order) of an object in the data source. Objects in data sources are . The first object is at index 0, the second is at index 1 and so on. The last object will have an index equivalent to Object Count minus one. Important: If you wish to implement user-sorting, you should define a separate integer property in the object class and use that to store the sort order.

The object is not .

The object is .

Data source attributes describe the state of the data source, for example if the data source is empty or how many are in the data source.

Alternatively, you could use the On Viewport Enter event handler on a container to trigger the action. An example of this is available in the .

The data source has finished processing data. This property is not often used as most data operations are synchronous and an action node won't run until the previous action node's data operations are complete. Data Ready can be useful when you run the with Run Asynchronous selected and the selection leads to a change in dependent data sources.

The data source is disabled and as a consequence is empty. This property can be set by selecting the Initially Disabled property, or using the .

The data source contains no .

The data source contains at least one .

The maximum number of objects that can be in the data source. This property can set by entering a value for the Initially Limit Object Count property, or using the .

The number of in the data source.

The number of objects to skip when reading objects into the data source. For example, if Skip is set to 2, the first 2 objects in the database that would normally qualify for the data source are ignored. This property can set by entering a value for the Initially Skip Object Count property, or using the .

The data source will update when a change is made by another user. This property can be set by selecting the Initially Subscribe To Updates property, or using the .

Update object action node
Calendar data sources
enum
Multi select
Set selection action node
Sort objects action node
performance optimization
object
objects
Showroom
database connected
data connector
runtime only
filter
Set data source attributes action node
Set data source attributes action node
CRUD operations
Persist objects action node
Set data source attributes action node
here
function
function
zero-indexed
Set selection action node
Set data source attributes action node
Set data source attributes action node
Set data source attributes action node
Set data source attributes action node
client filters
sorting
reference data sources
filter
object
object class
Data model
filter
How to optimise your app performance
Create object
Update object
Delete objects
database connected
runtime only
data connectors
calendars
enums
data source properties
Persist objects action node
Filters
Conditional Permissions
object class
Global data model
Set data source attributes action node
GraphQL mutations
built-in data sources
Conditional Permissions
Include Generated Data Sources
reference property
built-in properties
object class property
server rather than the client,
data types
selected
selected
selected
selected objects
selected object
selected objects