Skip to content

Multiple Executions

The documentation applies to:✅ v0.8.0

What is Multiple Executions?

When you configure one button on Dynamic List or Page, you will see Multiple Executions. It allows you to control a group of many steps on proceeding Database-side.

For example: You want to execute two commands such as Query then Insert on Database in one button. So Multiple Executions will help you this case.

Multiple Executions

Multiple Execution Context

Let take a look on this sequence flow below to help you understand a mechanism of Multiple Execution Context.

Multiple Executions Context

As the flow, when you run one Multiple Executions, a system will generate a context with data pattern

{
    "step1": { },
    "step2": { }
    // Step x: { }
}

Then when you want to get a data of previous step, you just use {{$step1}} to access.

Cross-Database

With this context, you can run cross-databases such as MongoDB, SQL Server, MySQL and PostgreSQL. LET Portal will handle a context for making sure to provide an approriate data.

However, you need to know which exact data can be stored per each command type

Command Type Stored Data Example
Query returned data from query { "id": "abc"}
Insert Number of inserted rows 10
Update Number of updated rows 10
Delete Number of deleted rows 10

Auto-Increment Column

Most of SQL databases are providing an auto-increment column for primary key. So you want to get this in returned data of Insert command. Fortunately, SQL allows you to run multiple commands on one run. So there are some examples for taking auto-increment column

``` sql tab="SQL Server" INSERT INTO Users(username, password) VALUES (N'admin', N'abc'); SELECT SCOPE_IDENTITY()

``` sql tab="MySQL"
INSERT INTO Users(username, password) VALUES (N'admin', N'abc');
SELECT LAST_INSERT_ID();

sql tab="PostgreSQL" INSERT INTO Users(id,username, password) VALUES (Default,N'admin', N'abc'); RETURNING id;

Ensure you break these commands by ;