For the complete documentation index, see llms.txt. This page is also available as Markdown.

Update object

The Update object action updates the object class properties of objects in a data source.

Usage

This action node is used to update properties on one or more objects in a data source.

To update many objects at once (a batch update) there are two possible methods:

  1. Use a While or Foreach action node to iterate over the objects. Add an Update object action node inside the iterator action node with the same data source selected and Object in context as the Selection.

  2. Use only the Update object action node. This method is more performant. See the example Batch update in the Examples section below.

When Update object operates on an object it becomes the object in context. This object in context contains the original values before the update and these can be accessed using data bindings and functions.

In addition, the values set in the update are available as self-properties. Self-properties are only available in functions. These can be used to update properties that are dependent on the values of other properties that are being updated in the same operation. In other words, a function must be used to access to new value of a property, if that property is updated in the same Update Object operations. See the example Update Object - Self Properties and dependencies below.

Examples

In this example, 1 object is updated. The properties Price and Product (reference) of an Order line is updated. As you see, the Price on the Order line is set equal to the price of the Product.

This example updates the Amount property of all Order Lines. Price and Units are retrieved and the Amount is calculated independently for each record.

You may use the value processor inside the Update Object action node. For example, to increase a value by 1.

Data binding to the same property, then tick "Value Processor"
The Value Processor setup

Imagine the following simple scenario. You want to set Property 1 to 20, and you want to set Property 2 equal Property 1 in the same Update Object operation

In the above example: if both Prop 1 and Prop 2 was 0 by default, then Prop 2 will still be 0 after this update. The reason is that Data Binding defaults to the old value of the bound property. If you want to access the new value, you must use a function, and add prop1 from the Self Properties list, as illustrated below:

In the function editor, as in the screenshot above, you may expand the data source in the left pane and add the same property as a function parameter from there. That will imply use the old value, and not the new value (self-property). &#xNAN;Note that you may only add properties directly at the data source itself as self-properties, and not reference properties (e.g. if you are updating Order Line.Product and Order Line.Price in the same operation, you cannot select Order Line.Product.Product Price as self-property)

Sometimes you want to update an Object Class Property having Cardinality Many, but you want to keep the existing list of references and add (or remove) a set of references. You can use the Value Processor for that.

Data binding to the same property, then tick "Value Processor"
When clicking "Add Selection" you may select the data source holding the references you want to add

Working with schemas

Update Object can target an action variable of type schema. When the target is a schema, the Values on update section maps new values onto the schema's properties, including nested properties. If the schema is an object or an array of objects, the object(s) must be instantiated using Create Object first. For schemas of type array, the only available selection is All objects — the update is applied to every object in the array. To update a specific object in an array, use a Foreach with a condition instead.

Property-to-property mapping is supported: a value from one schema property can be mapped directly onto another schema property in the same update.

When schema data needs to be written to the database, the property values from the schema can be mapped onto an action data source backed by an object class using Values on update, in the same way as on Create Object.

Important

When updating a nested schema path, the parent structure must already exist. If it does not, the action node raises an error. For example, updating Company.Address.City will fail if the Address object has not been created on Company.

Properties

Property
Description

Data Source

Select a data source that contains the object(s) to update.

Selection

Available if the selected Data Source is a many-cardinality data source. Define the objects to update.

Filter

Available when Selection is Filtered selection. Define the filter to apply to the data source.

Values on update

Set new values for any object class properties in the defined object(s).

Last updated

Was this helpful?