Tuple search (Form designer)

The Behaviour type Tuple search (Form designer) executes a configurable search in the Lobster Data Platform / Orchestration database (see also Search API) and returns the search results as a data service to the Actions on 'true'. This data service defines columns that match the Projections of the tuple search.

images/download/attachments/189432335/image-2024-10-2_8-48-59-version-1-modificationdate-1727851739821-api-v2.png

  • The Configure search button opens a dialog for search configuration.

  • With the option Return first result set, only the first match (if any) of the search is returned. Without the option, a list of all matches is returned.

If an element is linked to this behaviour type, which contains an object with properties and values, this data is provided to the context of the search as variables. For each data field specified for a child element, a variable bearing its name and value is created.

►IMPORTANT◄ If at runtime a linked element cannot be validated (see Validate element and Validators), e.g. because required fields are not filled in, the search is not executed and the Actions on 'false' apply. These actions receive element data (to include 'invalid' inputs) from the linked element. If this element does not specify a data field, data of a parent level, if not the form itself, is provided.

Using variables to access data of a linked element

A portal shall present the matches of a tuple search in a Data grid. The search should use input from a Text field (here: 'ID') as a parameter, to identify 'relevant' data objects by an appropriate condition.

images/download/attachments/189432335/image2020-3-27_11-44-49-version-1-modificationdate-1727851309400-api-v2.png

  • In the form, a Row layout container 'Search parameters' with data field searchParams is used as a parent element for the Text field 'ID' and further search parameters (t.b.d.).

  • Data field searchId is defined for the 'ID' field.

This results in the following data structure for the container 'Search parameters':

JSON output for the container 'Search parameters'
{
searchId: 0
}

Text field 'ID' is defined to Restrict input to 'Big Integer (long)', since this value will later be matches against object 'IDs' of that data type within the tuple search.

Clicking the Search button triggers the Tuple search (Form designer) behaviour, which refers to the Row layout container Search parameters as a linked element in its configuration. At runtime, the value entered into Text field 'ID' is handed to the Search API via a Variable named searchId:

images/download/attachments/189432335/image2020-3-27_12-1-21-version-1-modificationdate-1727851309398-api-v2.png

The configuration of the tuple search itself is enabled by a dialog opened by clicking the Configure search button:

images/download/attachments/189432335/image2020-3-27_12-10-23-version-1-modificationdate-1727851309395-api-v2.png

  • First of all, the Entity must be selected to identify the type of object to search for. In our example, we are searching for a Users object.

  • As Projections (which are only visible as nodes of the tree view in the screenshot above) the two properties 'User name' (username) and 'ID' (id) of the Users object were selected to correspond with the Data grid.

  • The screenshot shows the configuration for the Where condition, where a Field restriction defines an exact match ('==') between field 'ID' and the value of Variable searchId as a criterion.

images/download/attachments/189432335/image-2024-10-24_9-43-11-version-1-modificationdate-1729755790942-api-v2.png

The configuration for Actions on 'true' lists a Grid: Fill action, which uses the Data grid 'Search result' as a Target element for displaying the results of the Tuple search (Form designer).

The columns in this Data grid must specify data field names matching the names of Projections of the search. Not all Projections must appear in the Data grid.

►NOTE◄ Since the Field restriction in our example specifies an exact match for the unique id of the Users object, a maximum of only one match should appear in the Data grid in the existing configuration if read access exists for the 'searched' user account.