Skip to content

DragOnFlow Script Reference

Keywords

Flow Keywords

If then

Examples:

let a=4;
if (a==4) then
    // statements
elseif (a==7)
    // statements
else
    // statements 
endif

While

Literal Keywords

Empty

Returns an empty value (e.g. null)

Examples:

let a = empty;

False

the 'false' keyword evaluates to false

True

The 'true' literal evaluates to true

Variables Keywords

Delete

Delete a variable

Examples:

// Set and delete a variable
let a=2; // sets the values of a
delete a; // deletes variable a
// Set and delete a variable
let a.x=2; // sets the values of a.x
delete a; // deletes variable a, a.x is not affected

DeleteAll

Delete the all the variable whose path is starting with the provided path/name

Examples:

// Set and delete a variables
let a=2; // sets the values of a
let a.x=2; // sets the values of a.x
let abc.x=2; // sets the values of abc.x
DeleteAll a; // deletes variable a, z.x and abc.x

DeleteTree

Delete the provided variable and all it's descendants

Examples:

// Set and delete a variables
let a=2; // sets the values of a
let a.x=2; // sets the values of a.x
let abc.x=2; // sets the values of abc.x
DeleteTree a; // deletes variable a and z.x, but not abc.x

Let

Create a variable if not existing and sets a variable value

Examples:

// Set a variable
let a=2; // create variable 'a' and sets it's value to 2
let a=2+2; // Updates the variable to the value of the expression, 2+2 = 4
let a=\"text\"; // Updates the variable to the text 'text'

NameOf

Returns the name of the variable as a variable

Examples:

let a.x=2; // sets the values of a.x
let a.y= \"zz\"; // sets the values of a.y
let n = nameof a.x.{a.y} ; // n = 'a.x.zz'

Methods

Date and Time Methods

Date

Returns the a date from the provided year, month, day

Parameter Type Mutiple Description
Year Int64
Month Int64
Day Int64

datepart

Return the date part of a date time or text variant

Parameter Type Mutiple Description
value Any

DateToNumber

Returns a number in the form of YYYYMMDD from the provided date, this is usefull for building paths that contains date

Parameter Type Mutiple Description
date DateTime

Day

Returns the day of a date value. The day is given as an integer, ranging from 1 to 31.

Parameter Type Mutiple Description
value DateTime

FormatLongDateTime

Returns string from the date in a long date and time format. Depending on the langauge this can look like Sunday May 21, 2022 12:23:11 AM

Parameter Type Mutiple Description
value DateTime

FormatLongTime

Returns string from the date in a long time format.

Parameter Type Mutiple Description
value DateTime

FormatShortDate

Returns string from the date in a short date format.

Parameter Type Mutiple Description
value DateTime

FormatShortDateTime

Returns string from the date in a short date and time format. Depending on the langauge this can look like 21/5/2022 12:23

Parameter Type Mutiple Description
value DateTime

FormatShortTime

Returns string from the date in a short time format.

Parameter Type Mutiple Description
value DateTime

Hour

Returns the hour of a time value. The minute is given as an integer, ranging from 0 to 23.

Parameter Type Mutiple Description
value DateTime

IsDateTime

Tests if the provided value is a datetime or can be converted to date time.

Parameter Type Mutiple Description
value Any any type of variant

Minute

Returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.

Parameter Type Mutiple Description
value DateTime

Month

Returns the month of a date value. The month is given as an integer from 1 to 12.

Parameter Type Mutiple Description
value DateTime

Now

Returns the current date and time

parsedate

Try convert to date only, if successful return a Variant with the date else return empty variant

Parameter Type Mutiple Description
value Any

Second

Returns the seconds of a time value. The minute is given as an integer, ranging from 0 to 59.

Parameter Type Mutiple Description
value DateTime

TimeSpan

Returns the a new Time Span from the provided hours, minutes, seconds

Parameter Type Mutiple Description
Hours Int64
minutes Int64
seconds Int64

TimeSpan

Returns the a new Time Span from the provided hours, minutes, seconds

Parameter Type Mutiple Description
Days Int64
Hours Int64
Minutes Int64
Seconds Int64

Today

Returns the date for today

TotalDays

Calculates the total days in the TimeSpan as a floating point number

Parameter Type Mutiple Description
value TimeSpan

TotalHours

Calculates the total hours in the TimeSpan as a floating point number

Parameter Type Mutiple Description
value TimeSpan

TotalMinutes

Calculates the total minutes in the TimeSpan

Parameter Type Mutiple Description
value TimeSpan

TotalYears

Calculates the total years in the TimeSpan. Year is 365.25 days, this function can't calculate with leap year because it has no reference.

Parameter Type Mutiple Description
value TimeSpan

UserNow

Returns the current date and time in the user time zone

Examples:

Let a = userNow();

Year

Returns the years of a date value. The year is given as an integer.

Parameter Type Mutiple Description
value DateTime

Flow Methods

Chain

Sets the key of the next pattern in VM

Parameter Type Mutiple Description
key String

IIF

Returns one of two parts, depending on the evaluation of an expression. You can use IIf anywhere you can use expressions. You use IIf to determine if another expression is true or false. If the expression is true, IIf returns one value; if it is false, IIf returns another. You specify the values IIf returns.

Parameter Type Mutiple Description
expression Bool
OnTrue Any
OnFalse Any

iSwitch

An extention of the IIF to allow multiple contitions and values.

Parameter Type Mutiple Description
value Any The input value to compare
case_value1 Any value to compare with for the first option
result_value1 Any Result for the first option
default Any Optional, if specified the default if none of the cases is matched

Examples:

let result = iSwitch(value,
    1, "One",
    2, "Two",
    3, "Three",
    "Default");

General Methods

Contains

Check if the list contains a value

Parameter Type Mutiple Description
value List
Find Any

Count

Returns the number of items in the value (if list), or if a text the number of characters

Parameter Type Mutiple Description
value Any

IncludesOnly

Check if the list only contains only items from a list of values

Parameter Type Mutiple Description
value List
find List

IsNewSession

Returns true if this session is new, e.g. Old session expired, new browser tab...

Length

Returns the number of items in the value (if list), or if a text the number of characters

Parameter Type Mutiple Description
value Any List or string

SetLanguage

Sets the session langauge

Parameter Type Mutiple Description
language String Name or iso code of the language, e.g. "en-US", "russian"…

Trace

Writes a message into the log

Parameter Type Mutiple Description
message Any

TraceError

Write an error message into the log

Math Methods

ceiling

Returns the smallest integral value greater than or equal to the specified number.

Parameter Type Mutiple Description
value Number

Cos

Calculate cosine of specified angle.

Parameter Type Mutiple Description
value Number

floor

Returns the largest integral value less than or equal to the specified number.

Parameter Type Mutiple Description
value Number

Int

Converts the value to an integer, if fails return the default

Parameter Type Mutiple Description
default Int64
value Any

Int

Converts the value to an integer

Parameter Type Mutiple Description
value Any

Lan

Returns the base E logarithm of a specified number.

Parameter Type Mutiple Description
Value Number

Log

Returns the base 10 logarithm of a specified number.

Parameter Type Mutiple Description
value Number

Max

return the max value from the list

Parameter Type Mutiple Description
items List

Max

Gets multiple variables and returns the maximum. The variables can be of any type, the first variable is used to set the type

Parameter Type Mutiple Description
item1 Any
rest Any Yes

Examples:

let p = max(7,5,3,8); // p= 8
let p = max("a","b",8,2); // p= "b"

Min

Retunr the minimum value from the list

Parameter Type Mutiple Description
Items List Yes

Min

Gets multiple variables and returns the maximum. The variables can be of any type, the first variable is used to set the type

Parameter Type Mutiple Description
item1 Any
restItems Any Yes

Pow

Returns a specified number raised to the specified power.

Parameter Type Mutiple Description
value Number
power Number

round

Returns the largest integral value less than or equal to the specified number.

Parameter Type Mutiple Description
value Number

Sin

Calculate sine of specified angle.

Parameter Type Mutiple Description
value Number

Sqrt

Returns the square root of a specified number.

Parameter Type Mutiple Description
value Number

sum

Returns the sum of items in the list.

Parameter Type Mutiple Description
value List

Sum

Caclulate the sum of the parameters

Parameter Type Mutiple Description
item1 Number
rest Number Yes

tan

Calculate tangent of specified angle.

Parameter Type Mutiple Description
value Number

Privacy & Security Methods

HashPassword

Hashes a password, if you get password from the user, hash it as soon as possible then discard the password.

Parameter Type Mutiple Description
password String The password to hash

Text Methods

EndsWith

Check if the provided text ends with the provided item.

GetActiveLanguageTag

Returns the current active Language code "he", "en-GB", "en-US" etc.

LeftPad

Pads a variant with the provided char up to specified length, the result is text.

Parameter Type Mutiple Description
length Int64
char Char
value Any

padleft

Adds copies of a char to the left of the provided string

Parameter Type Mutiple Description
value String
charToAdd Char
count Number

padright

Pads the provided text with copies of the char

Parameter Type Mutiple Description
value String
charToPad Char
count Number Number of copies

replace

Replaces all instances of specified 'find' 'strings with the ReplaceWith.

Parameter Type Mutiple Description
text String
find String
replaceWith String

RightPad

Pads a variant with the provided char on the right, up to specified length, the result is text.

Parameter Type Mutiple Description
value String
char Char character to pad with
length Number

StartsWith

Check if the provided text starts with the provided item.

trim

Returns the text removing all leading and trailing spaces. On other types, returns the string value of the variant

Parameter Type Mutiple Description
value String

UpperCase

Return the upper case of the provided text (will convert to string if a non text is provided)

Parameter Type Mutiple Description
value Any

Variables Methods

CountChildren

Returns the number of children (direct children) of the location specified by value

Parameter Type Mutiple Description
value String

Examples:

let a.a=2;
let a.b=2;
let a.a.a=2;
let b= CountChildren(nameof a);  // b = 2

CountDescendants

Returns the number of all descendants of the location specified by value

Parameter Type Mutiple Description
value String

Examples:

let a.a=2;
let a.b=2;
let a.a.a=2;
let b= CountDescendants(nameof a);  // b = 3

Exists

Check if the provided variable exists

Parameter Type Mutiple Description
variableName String

Examples:

let a=2;
let b= Exists("a");  // b is true note that we pass a string with the name of the variable

IsEmpty

Check if the provided variable esists and does not have a value (e.g. equal to null)

Parameter Type Mutiple Description
VariableName String

Examples:

// note that we pass a string with the name of the variable  
let a=2;
let b= IsEmpty(\"a\");  // b is false 

let c=null; 
let b2= @c.IsEmpty();  // b2 is true

// no variable zzz
let b3= @zzz.IsEmpty();  // b3 is true,

isnotempty

return false if the variable exists and is not empty

Parameter Type Mutiple Description
variablePath String

Examples:

// note that we pass a string with the name of the variable  
let a=2;
let b= IsEmpty(\"a\");  // b is true, the variable exists and is not empty

let c=null; 
let b2= @c.IsEmpty();  // b2 is false

// no variable zzz
let b3= @zzz.IsEmpty();  // b3 is false,

LastPathSegment

Returns the last segment in the path, e.g. "local.shop.x7" returns "x7"

Parameter Type Mutiple Description
path String

MaxKey

Finds the maximum from all the names of the children of 'path' (not descendants, just children). returnRelativePath: if true returns path relative to the 'path'

Parameter Type Mutiple Description
Path String
returnRelativePath Bool

Examples:

let a.a=2;
let a.b=2;
let a.b.z=2;
let b= MaxKey(\"a\",false);  // returns 'a.b' because b is the largest key under 'a' 
let b= MinKey(\"a\",true);  // returns 'b' the direct child key

MinKey

Finds the minimum from all the names of the children of 'path' (not descendants, just children). returnRelativePath: if true returns path relative to the 'path'

Parameter Type Mutiple Description
path String
returnRelativePath Bool

Examples:

let a.k=2;
let a.k.a=2;
let a.b=2;
let a.b.a=2;
let b= MinKey(\"a\",false);  // returns 'a.b' because b is the smallest key under 'a' 
let b= MinKey(\"a\",true);  // returns 'b' the direct child key

vup

Up the variable path, removes the last token of the provided path

Parameter Type Mutiple Description
path String

Operators

Comparison Operators

Not equal operator

The !== operator returns true if its left operand is not equal its right operand, otherwise false

Less than operator <

The < operator returns true if its left operand is less than its right operand, otherwise false

Less than equal operator <=

The <= operator returns true if its left operand is less than or equal its right operand, otherwise false

Equal operator ==

The == operator returns true if its left operand is equal its right operand, otherwise false

Compare as case insensitive string

Compare the operands as strings, ignoring case

Examples:

if (myvar ==i "SoMe TeXT")

Greater than operator >

The > operator returns true if its left operand is greater than its right operand, otherwise false

Examples:

let a=7;
let b=5;
let r= a > b;  // r = true

Greater than equal operator >=

The >= operator returns true if its left operand is greater than or equal its right operand, otherwise false

Examples:

let a=7;
let b=5;
let c=5;
let r= a >= b;  // r = true
let r= b >= c;  // r = true

Date and Time Operators

The date parse operator

The # operator marks the beginning and end of a date, time or both

Examples:

let d = #2020-01-23# ;   sets d to the date 23rd jan 2020

Logical Operators

Or operator ||

The || operator returns true if left or right (or both) operands are evaluated to true

Examples:

let a=true;
let b=true;
let c=false;
let r= a || b;  // r = true
let r= a || c;  // r = true

And operator

The AND operator returns true if both left and right operands are evaluated to true

Not

The unary not operator computes logical negation of its operand. That is, it produces true, if the operand evaluates to false, and false, if the operand evaluates to true:

Examples:

let a = not true;  // a = false

Or operator

The OR operator returns true if left or right (or both) operands are evaluated to true

Examples:

let a=true;
let b=true;
let c=false;
let r= a or b;  // r = true
let r= a or c;  // r = true

Xor operator

The XOR operator returns true if left and right operands are evaluated to different boolean values (e.g. one true and the other is false)

Examples:

let a=true;
let b=true;
let c=false;
let r= a xor b;  // r = false
let r= a xor c;  // r = true

Math Operators

Substruction operator -

The substructionoperator substruct the right side operand from the left side operand

Examples:

let a=7;
let b=4;
let c=a-b;  // c=3

Multiplication operator *

The multiplication operator * multiplies its operands

Examples:

let a=2;
let b=5;
let c=a*b;  // c = 10

Devision operator /

The Devision operator devide the left side operand by the right

Examples:

let a=2;
let b=5;
let c=a*b;  // c = 10

Addition operator +

      "let c=a+b;  // c = 7"

The addition operator + adds its operands

Examples:

let a=2;
let b=5;
let c=a+b;  // c = 7

Modulu mod

The 'mod' returns the remainder of devision or modulu

Text Operators

Concat operator &

The concat operator returns text by joining the left and right operands when evaluated to string

Examples:

let a="123";
let b="zzz";
let r= a & b;  // r = '123zzz'

Variables Operators

Name of operator

The @ operator, returns the path of the provided variable as a text.

Examples:

let id = "12"
let path = @patients.{id} ; sets path to the string "patients.12"

System variables

Language Variables

system.defaultlanguage.id

Numeric identifier of the default language of the project.

system.defaultlanguage.name

Name (in english) of the default language of the project.

system.languages.ids

List of codes for the current project languages.

system.languages.names

List of names for the current project languages.

Project Variables

Project name

The name of the project.

Project version

Version of the project, as specified in the project file.

system.compiler.version

Version of compiler used for the compilation of the project.

system.vm.count

Total messages processed by the project sinse it was last started.

system.vm.startdate

Date when the project was last started.

system.vm.startdatetime

Date and time when the project was last started.

system.vm.starttime

Time when the project was last started.

Server Variables

system.server.name

returns the server running the project (as defined in the config file).

User Variables

system.user.id

Returns the current user identification code. Depending on the user connector, this can be a alphanumeric code, phone number…

User session ID

Returns the current user identification code. Depending on the user connector, this can be a alphanumeric code, phone number…