How is your experience with the OutSystems Community?
record-manipulation
Service icon

Record Manipulation

Stable version 2.0.0 (Compatible with OutSystems 11)
Other versions available for 10 and Older
Uploaded
 on 29 Oct (yesterday)
 by 
5.0
 (4 ratings)
record-manipulation

Record Manipulation

Documentation
2.0.0

Record Manipulation

Read and change the attributes of any record by its path, whatever its structure: entities, structures, records that combine several entities, and records with nested lists. It also tells you a record's type name and the keys of its entity.

Before you start

  • Pass records and lists with ToObject(). Every action takes its record or list as an Object, for example ToObject(GetCustomers.List.Current) or ToObject(GetCustomers.List).
  • Change values through a list. A record passed on its own with ToObject() is a copy, so the Set actions work on a record inside a list: the list's Current record, or the one at a position.
  • Check Found or IsSuccessful. The Get actions return Found and the Set actions return IsSuccessful instead of raising exceptions. When it's False, ErrorMessage says what went wrong.

Paths

A path names an attribute, starting from the record you pass:

PathWhat it points to
NameThe Name attribute of the record.
Customer.NameThe Name attribute of the Customer entity or structure inside the record, such as the record of an aggregate that joins several entities.
ChildList.Current.NameThe Name attribute of the Current record of ChildList, a list attribute.
ChildList[1].NameThe Name attribute of the record at position 1 of ChildList. Positions start at 0, so this is the second record.

The name of an entity or structure in a record is optional: when a name isn't found in a record, it's looked for in the record's first entity or structure. So for the record of an aggregate on Customer, Name and Customer.Name point to the same attribute. In the same way, ChildList[1].Name and ChildList[1].Child.Name are the same when ChildList is a list of Child.

Actions

GetRecordPathValue

Returns the value at a path as an Object. Use it to pass the value on to another action that takes an Object, such as the Set actions below.

ParameterDirectionTypeDescription
RecordInput (mandatory)ObjectThe record, wrapped in ToObject().
PathInput (mandatory)TextThe path of the value. See Paths.
ValueOutputObjectThe value at the path.
FoundOutputBooleanTrue if the path was found.
ErrorMessageOutputTextThe error details when Found is False.

GetRecordPathStringValue

Returns the value at a path as Text.

ParameterDirectionTypeDescription
RecordInput (mandatory)ObjectThe record, wrapped in ToObject().
PathInput (mandatory)TextThe path of the value. See Paths.
DateTimeFormatInputTextHow to format Date, Time and Date Time values, as a .NET date and time format. Default: "yyyyMMddHHmmss.fff".
ValueOutputTextThe value at the path, as Text.
FoundOutputBooleanTrue if the path was found.
ErrorMessageOutputTextThe error details when Found is False.

Date, Time and Date Time values use DateTimeFormat. Decimals keep up to 8 decimal places. Other values are converted as they are, for example True or 42.

GetRecordPathStringValue(
    Record: ToObject(GetCustomers.List.Current),
    Path: "Customer.Name")
→ Value = "Ana Silva"

SetRecordListCurrentPathValue

Sets the value at a path in the Current record of a list. Use it inside a For Each to change each record in turn.

ParameterDirectionTypeDescription
RecordListInput (mandatory)ObjectThe list, wrapped in ToObject().
PathInput (mandatory)TextThe path of the value to set, starting from the Current record. See Paths.
ValueInput (mandatory)ObjectThe new value, wrapped in ToObject(). It must have the attribute's data type, for example ToObject(10) for an Integer.
IsSuccessfulOutputBooleanTrue if the value was set.
ErrorMessageOutputTextThe error details when IsSuccessful is False, for example when the list is empty.

SetRecordListPositionPathValue

Sets the value at a path in the record at a given position of a list.

ParameterDirectionTypeDescription
RecordListInput (mandatory)ObjectThe list, wrapped in ToObject().
PathInput (mandatory)TextThe path of the value to set, starting from the record at Position. See Paths.
PositionInput (mandatory)IntegerThe position of the record. Positions start at 0.
ValueInput (mandatory)ObjectThe new value, wrapped in ToObject(). It must have the attribute's data type, for example ToObject(10) for an Integer.
IsSuccessfulOutputBooleanTrue if the value was set.
ErrorMessageOutputTextThe error details when IsSuccessful is False, for example when the position is past the end of the list.

This action iterates over the list to reach the position. If the list is already being iterated, for example inside a For Each over it, the action returns IsSuccessful = False and leaves that iteration running. Use SetRecordListCurrentPathValue inside the For Each instead.

SetRecordListPositionPathValue(
    RecordList: ToObject(GetCustomers.List),
    Path: "Customer.Name",
    Position: 0,
    Value: ToObject("Ana Silva"))

GetRecordAttributes

Lists the attributes of a record.

ParameterDirectionTypeDescription
RecordInput (mandatory)ObjectThe record, wrapped in ToObject().
AttributesOutputRecordManipulationAttribute ListOne item per attribute, with its name.

For a record of a single entity or structure, you get that entity's or structure's attributes. For a record that combines several, you get one item per entity or structure, named with an EN or ST prefix (for example ENCustomer). Every name returned works as a path. If Record is empty, the action raises an exception.

GetRecordTypeName

Returns the name of a record's type: the name of its entity or structure.

ParameterDirectionTypeDescription
RecordInput (mandatory)ObjectThe record, wrapped in ToObject().
NameOutputTextThe name of the record's type, or empty when Record is empty.

For an entity record, or the record of a single entity, you get the entity's name (for example Customer). For a structure, you get the structure's name. For a record that combines several entities, you get the name the platform generates for that record. Lists and basic values return their .NET type name, for example RLCustomerRecordList or String.

GetRecordSSKey

Returns the key of a record's entity, and the key of the module or extension that defines it. The keys come in the format of the SS_Key values in the platform's metadata, so you can look the entity up there.

ParameterDirectionTypeDescription
RecordInput (mandatory)ObjectAn entity record, the record of a single entity, or a list of either, wrapped in ToObject(). An empty list works too.
KeyOutputTextThe key of the entity, as a lowercase GUID.
OwnerKeyOutputTextThe key of the module or extension that defines the entity, as a lowercase GUID. For an entity defined in an extension, this is the extension's key.

Both outputs are empty when Record is empty or holds no entity, such as a structure. For a record that combines several entities, the action raises an exception naming them. Pass the record of one of them instead, for example ToObject(GetCustomerOrders.List.Current.Customer).

GetRecordSSKey(Record: ToObject(GetCustomers.List.Current))
→ Key      = "5b0e7c1a-2f4d-4c8e-9a3b-6d1f0e2c4a7b"
→ OwnerKey = "e3a9d2f4-7c1b-4e6a-8f05-b2c4d6e8a0f1"

Structures

RecordManipulationAttribute

An attribute read from a record by GetRecordAttributes.

AttributeTypeDescription
NameText (50)The name of the attribute.