Functions

QLingo functions are small reusable blocks of code that perform a specific task.

Functions in QLingo are not case sensitive. Ucase(), UCASE(), ucase() and uCase() all perform the same uppercase string function.

QLingo functions usually require one or more input values called parameters. Parameters must be listed in the specified order, separated by commas, and have the data type that the function is expecting. Sometimes parameters are optional and can be omitted or use an empty string ("").

An example of a common numeric task is formatting a number, which requires three parameters. The first parameter is the numeric value to format, the second parameter is the pattern to use for formatting that number, and the third value (true or false) allows a comma as the decimal separator. For example, formatting the currency to include two digits and the dot as the decimal separator:

FormatNumber(12345, "$##,###.00", False)

Returns: "$12,345.00"

Expanding on that, a function’s parameters are expressions and may contain functions themselves. A function within function is known as nesting. For example, below we are first rounding the decimal amount, then formatting the currency to use spaces for the thousandth's separator and a comma as the decimal separator:

FormatNumber(Round(1298.765, 2), "### ###,00€", True)

Returns: "1 298,77€"

In uPlan, comments, extra spaces and lines in expressions are also permitted to help improve understanding. For example, the previous example could be written like this:

Copy
FormatNumber(
   Round(
      1298.765, //input number
      2         //# of decimal places
   ),
  "### ###,00€" //format the result with a Euro sign and always show 2 decimals and the comma decimal
)

Note that in uCreate Print, comments and extra spaces are removed when the expression is displayed in uCreate Print's QLingo editor.

Recipient information from the data source is often used as the parameter for functions. For example:

Ucase(|->[Firstname])

Additionally, plan variables can be used as parameters. For this example, the plan variable called "calculated balance" is used:

FormatNumber(@{calculated balance}, "###,###.00")

Categories of QLingo functions

QLingo functions are grouped into different categories based on the type of data they are designed to work on, or return. For more information on specific types of functions, refer to:

Watch a video

Learn about uPlan’s functions