System and flow control

Learn how to pause scripts, inspect the app execution context.

System and flow control functions help you manage timing, sync, caching, and environment-specific behavior. You can pause a script, inspect raw values, and detect app context.

In this chapter, you will learn how to:

  • Control timing in a running script.

  • Inspect the current app environment and database status.

Function (A-Z)
Task

ninoxApp()

Return the current client or app context

raw()

Return the internal text representation

sleep()

Pause a script briefly

start()

Return the start timestamp of an appointment

Control timing and execution order

Use these functions when one action should happen only after another has completed.

Pause a script briefly

Use sleep() to force Ninox to wait for a given number of milliseconds before the script continues.

Use it when you want to:

  • Add a short delay before a follow-up action.

  • Avoid timing issues in a UI flow.

  • Wait briefly for another process to settle.

  • Show a note or warning before the next step runs.

sleep(number)

  • number: the delay in milliseconds

sleep() returns no value.

Let’s take a look at some examples:

Pauses the script for 2 seconds.

Tips:

  • Keep delays as short as possible.

  • Use a delay only when the flow really needs it.

Inspect raw values and range boundaries

Use these functions when you need the underlying value or the start boundary of a duration or range context.

Inspect the raw value

Use raw() to return the internal raw text representation of a value.

Use it when you want to:

  • Convert formatted text into its raw text form.

  • Read the internal value behind a color field.

  • Reuse formatted content in dialogs or emails.

  • Compare the raw form with the displayed form.

raw(any)

  • any: the value you want in raw form

raw() returns a string.

Let’s take a look at some examples:

Returns the content of a formatted text value as unformatted text with HTML tags.

Displays a dialog with the contents of the formatted text field Dialog text.

Returns the internal color value, for example #EC87E2.

Tips:

  • Use raw() when you need the system's internal text representation.

  • This is useful for formatted text fields, dialogs, and emails.

  • You can format the result again later with html().

Detect app context and database state

Use these functions when your script should react to the current client or the protection status of the database.

Detect the current app with ninoxApp()

Use ninoxApp() to check where your script is executed.

Use it when you want to:

  • Adjust behavior by client.

  • Diagnose client-specific workflows.

ninoxApp()

ninoxApp() returns a string that identifies the current environment.

Possible return values include:

  • client

  • server

Let’s take a look at some examples:

Returns a string where the script is running.

Tips:

  • Use ninoxApp() to check if your UI-based functions can be executed, which is not the case if the result is "server".

Last updated

Was this helpful?