Read objects

The Read objects action node adds existing objects into a runtime-only data source. The existing objects can be read from another data source or directly from the database.

Usage

This action node is used to populate runtime-only data sources with objects as needed during runtime. Read objects adds an exact copy of an object in the target data source – it is the same object as in the source data source (or the database) with the same ID. To instead duplicate an object, use Duplicate objects.

A common use case for Read objects is to copy an object for editing. As it is copied to a runtime-only data source any changes only exist in the client user's session until they are persisted.

Read objects can also be used to improve performance by only populating a data source when it will be used. The objects can be added directly from the database, but if the required objects are already present in another data source reading them from there will be more performant.

Example

Your app manages the various products you have for sale. All the products are accessed and updated via a database-connected data source. When you edit a product, the change is immediately stored in the database. Instead, you'd like to be able to edit a product but then choose to cancel or save the changes.

To do this, trigger an action when you want to edit a product that uses Read objects to read that product object into a runtime-only, single-cardinality data source. Adjust the edit UI to be bound to the properties in this new data source and add a Cancel and Save button.

When the Save button is clicked, run a Persist objects action node to save the changes to the database and navigate back to the previous view.

When the Cancel button is clicked, just navigate back to the previous view. The changes will still exist in the runtime-only data source but will not be saved in the database. Optionally, run a Delete objects action node to remove the project object (and all the changes) from the runtime-only data source.

Properties

PropertyDescription

Data Source

Select a runtime-only data source to read the objects into. If the data source is single-cardinality, ensure that it does not have Auto Create selected.

Set Selected

Available if the selected Data Source is a many-cardinality data source. Set the newly read objects as selected. If the data source already contains selected objects, they will remain selected.

Operation

Select how existing objects in the selected Data Source will be treated. If the selected Data Source is a single-cardinality data source the operation will be restricted to Replace All Objects.

  • Replace All Objects: Remove any existing objects before reading in the objects.

  • Add to Data Source (replace duplicates): Keep any existing objects. If an existing object has the same ID as an object being read into the data source, it will be replaced by the newly read object.

Read from other

Read objects from another data source. If this is not selected, the objects will be read directly from the database. It is more performant to read from another data source.

From Data Source

Available if Read from other is selected. Select a data source to read the objects from.

Selection

Available if Read from other is selected and the From Data Source is a many-cardinality data source. Define the objects to read.

Filter

Available when Read from other is not selected or when Selection is Filtered selection. Define the filter to apply to the data source. If this property is visible, a filter must be defined otherwise no objects will be read.

Sorting

Add sorting rules. The objects will be sorted before they are read in to the data source.

Skip First

Skip the first n records read.

Limit Result

Limit the maximum number of objects read into the data source.

Last updated