Skip to main content

Control Flow

Lido provides action formulas for controlling the execution flow of actions — chaining them in sequence, running them in parallel, repeating, pausing, and debugging.


CHAIN

Executes multiple actions in sequence, one after another. This is an action formula.

Syntax:

=CHAIN(action1, action2, ...)
=CHAIN(action1, action2, ..., delay)

Parameters:

ParameterDescriptionRequired
action1, action2, ...Action-returning formulas or cell references to action cellsYes
delayOptional delay in milliseconds between each action (must be the last argument and a non-negative number)No

Example:

=CHAIN(COPYFILE(source, dest), SLEEP(2000), PRINT("Done"))

Copies a file, waits 2 seconds, then prints a message.

=CHAIN(A1, A2, A3, 500)

Runs the actions in cells A1, A2, and A3 in order, with a 500ms delay between each.


BATCH

Executes multiple actions in parallel. This is an action formula.

Syntax:

=BATCH(action1, action2, ...)
=BATCH(action1, action2, ..., batch_size)

Parameters:

ParameterDescriptionRequired
action1, action2, ...Action-returning formulas or cell references to action cellsYes
batch_sizeMaximum number of actions to run concurrently (must be the last argument and a non-negative number; default: 10000)No

Example:

=BATCH(SENDGMAIL(cred, "a@b.com", "Hi", "Body"), SENDGMAIL(cred, "c@d.com", "Hi", "Body"))

Sends both emails simultaneously.

=BATCH(A1:A100, 5)

Runs actions in cells A1 through A100 in batches of 5 at a time.


REPEAT

Repeats an action a specified number of times. This is an action formula.

Syntax:

=REPEAT(action, count)

Parameters:

ParameterDescriptionRequired
actionAction-returning formula to repeatYes
countNumber of times to repeatYes

SLEEP

Pauses action execution for a specified number of milliseconds. This is an action formula.

Syntax:

=SLEEP(milliseconds)

Parameters:

ParameterDescriptionRequired
millisecondsDuration to pause in millisecondsYes

Example:

=SLEEP(5000)

Pauses for 5 seconds.


PRINT

Outputs a message for debugging and logging purposes during action execution. This is an action formula.

Syntax:

=PRINT(message)
=PRINT(message, color)

Parameters:

ParameterDescriptionRequired
messageThe text to outputYes
colorColor for the message in the output console (default: "gray")No

Example:

=PRINT("Processing complete for " & A2)
=PRINT("ERROR: Missing data", "red")