Skip to main content

Veritran Docs

How to obtain and use an array value with a pre-selected row in a lambda process

Platform component

Veritran Studio - Lambdas

Version

2.10/2.11/3.0

Context

You are working on a new app for GoldBank and you want the user to be able to select one of their accounts to perform a transaction, for example, to transfer money. Also, you want the app to use that information to obtain the account number and execute the transaction.

In Studio, the list of accounts is built using a data grid component and all the information of the user's accounts is saved in an array. When the user selects an account (which represents an array row), the account number should be obtained from the array through a lambda process to then execute the transaction.

To do so, you need to configure a lambda process that includes a specific array value, where the array row was previously selected from a visual component, such as a data grid component.

Solution

Expressions with the following syntax #A{array:row:column}, used to obtain a value within an array, can be used in lambda processes.

In some specific cases, for example, when using a data grid component, you may pre-select a row and need to complete the other values in the expression to obtain a specific value within that array. In those cases, you can use the same expression and complete the row value with the letter "S", which represents the row previously selected, for example: #A{50:S:2}, and use that expression to obtain the array value desired. To do so, follow these steps:

  1. Find the save register () with value () block in the list of blocks' Registers section, and drag and drop it into the on start block of your canvas.

  2. Complete the first slot with the register number where you want to save the array value.

  3. Drag and drop the " " block from the list of blocks' Text section into the second slot.

  4. Write or paste the array expression (e.g. #A{50:S:2}) into the text block. The value assigned to that array's specific row and column will then be saved into the register. Refer to the animated image below to see an example of how to perform the actions described in steps 1 to 4.

lambdasarrayhowto.gif

Then, continue configuring your process by adding the necessary blocks below the save register () with value () block and retrieve the array value from that register whenever you need to use it.