When designing the business logic of your application, you can use the built-in functions described in this topic.

One important characteristic regarding built-in functions is that they never throw an error, but return the default value instead.

Math Functions

Name

Description

Abs(Decimal)

Returns the absolute value (unsigned magnitude) of a number.

Mod(Decimal, Decimal)

Returns the remainder of decimal division of two numbers.

Power(Decimal, Decimal)

Returns the first parameter raised to the power of the second parameter.

Round(Decimal)

Returns a decimal value rounded.

Sqrt(Decimal)

Returns the square root of a number.

Trunc(Decimal)

Removes the decimal part of a number.

Numeric Functions

Name

Description

Max(Decimal, Decimal)

Returns the largest value of two numbers.

Min(Decimal, Decimal)

Returns the smallest value of two numbers.

Sign(Decimal)

Returns -1 if the input parameter value is negative; 1 if the value is positive; 0 if the value is 0.

Text Functions

Function

Description

Chr(Integer)

Returns a character according to the ANSI character code you provide in the input parameter.

Concat(Text,Text)

Connects two texts into a third one.

EncodeHtml(Text)

Converts a string replacing the reserved characters with their HTML character code. Use this function to increase security when working with un-escaped expressions in HTML literals.

EncodeJavascript(Text)

Converts a string replacing the reserved characters with their JavaScript character code. Use this function to increase security when working with un-escaped expressions in JavaScript literals.

EncodeSql(Text)

Converts a string replacing the reserved characters with their SQL character code. Use this function to increase security when managing inline parameters in your SQL statements.

EncodeUrl(Text)

Returns a string with all non-alphanumeric characters coded in order to be used in URL parameter values. Use this function to increase security when managing URL's in your application.

Index(Text, Text, [Integer], [Boolean], [Boolean])

Returns the zero-based position in a text where search text can be found.

Length(Text)

Returns the number of characters in a text.

NewLine()

Returns a string containing the New Line (Return) character.

Replace(Text, Text, Text)

Returns a text after replacing all occurrences of a substring by a replacement string.

Substr(Text, Integer, Integer)

Returns a part of a text beginning at a certain position and with a specified number of characters.

ToLower(Text)

Converts a text into the equivalent lowercase text.

ToUpper(Text)

Converts a text into the equivalent uppercase text.

Trim(Text)

Removes all leading and trailing white spaces from a text.

TrimEnd(Text)

Removes all trailing white spaces from a text

TrimStart(Text)

Removes all leading white spaces from a text.

Date & Time Functions

Name

Description

AddDays(DateTime, Integer)

Adds a specified number of days to a date.

AddHours(DateTime, Integer)

Adds a specified number of hours to a date.

AddMinutes(DateTime, Integer)

Adds a specified number of minutes to a date.

AddMonths(DateTime, Integer)

Adds a specified number of months to a date.

AddSeconds(DateTime, Integer)

Adds a specified number of seconds to a date.

AddYears(DateTime, Integer)

Adds a specified number of years to a date.

BuildDateTime(DateTime, Time)

Returns a Date Time value created from the provided date and time parameters.

CurrDate()

Returns the current system date on the server.

CurrDateTime()

Returns the current system date and time on the server.

CurrTime()

Returns the current system time on the server.

Day(DateTime)

Returns the day of the dt parameter.

DayOfWeek(DateTime)

Returns the day of the week of the Date Time input parameter, ranging from 0 (Sunday) to 6 (Saturday).

DiffDays(DateTime, DateTime)

Returns the difference in days between two dates.

DiffHours(DateTime, DateTime)

Returns the difference in hours between two dates.

DiffMinutes(DateTime, DateTime)

Returns the difference in minutes between two dates.

DiffSeconds(DateTime, DateTime)

Returns the difference in seconds between two dates.

Hour(DateTime)

Returns the hour of a Date Time value.

Minute(DateTime)

Returns the minute of a Date Time value.

Month(DateTime)

Returns the month of a Date Time value.

NewDate(Integer, Integer, Integer)

Returns a Date value created from the year, month, and day parameter values you provide.

NewDateTime(Integer, Integer, Integer, Integer, Integer, Integer)

Returns a Date Time value created from the year, month, day, hour, minute and second parameter values you provide.

NewTime(Integer, Integer, Integer)

Returns a Time value created from the hour, minute and second parameter values you provide.

Second(DateTime)

Returns the seconds of a Date Time value.

Year(DateTime)

Returns the year of Date Time value.

Data Conversion Functions

Convert Data Type Functions to

Description

Text Functions to convert from Boolean, Integer, Long Integer, Decimal, Date Time, Date, Time, and Identifier values to Text.
Integer Functions to convert from Boolean, Long Integer, Text, and Identifier values to Integer.
Long Integer Functions to convert from Decimal, Text, and Identifier values to Long Integer.
Decimal Functions to convert from Integer, and Text values to Decimal.
Boolean Functions to convert from Integer, and Decimal values to Text.
Date Time Functions to convert from Date, and Text values to Date Time.
Date Functions to convert from Date Time, and Text values to Date.
Time Functions to convert from Date Time, and Text values to Time.
Identifier Functions to convert from Integer, Long Integer, and Text values to Identifier.
Object Function to convert from an expression to Object.

Default Values Functions

You can get the default values of Binary, Date, Identifier, and Object data types by calling these functions.

Format Functions

Name

Description

FormatCurrency(Currency, Text, Integer, Text, Text)

Builds a Text with a formatted Currency value.

FormatDecimal(Decimal, Integer, Text, Text)

Builds a Text with a formatted Decimal value.

FormatFullDate(Date, Text)

Builds a Text with a formatted Date value.

FormatFullDateTime(Date, Text, Text)

Builds a Text with a formatted Date Time value.

FormatMonthDayDate(Date, Text)

Builds a Text with a formatted Date value using the specified separator to separate the month.

FormatPercent(Decimal, Integer, Text)

Builds a Text with a formatted Decimal value followed by '%'.

FormatPhoneNumber(Text, Integer, Integer, Integer, Text, Text, Text)

Builds a Text with a formatted Phone Number.

FormatShortDate(Text, Text)

Builds a Text value with a simply formatted Date value.

FormatShotDateTime(Text, Text, Text)

Builds a Text value with a simply formatted Date Time value.

FormatText(Text, Integer, Integer, Boolean, Text)

Formats a Text value to a specified length, by cutting characters, or by adding a padding character to fill the Text to the desired length.

FormatTime(Time, Text)

Builds a Text value from a Time value, separating all time components with a certain separator.

FormatYearMonthDate(Date, Text)

Builds a Text value from a Date value, separating the year and month components with a certain separator.

Email Functions

Name

Description

EmailAddressCreate(Text, Text)

Returns a Text value containing the name and the e-mail address you specify in the parameters.

The resulting Text can then be used in the Send Email element (action flows) or in the Send Email activity (process flows).

EmailAddressesConcatenate(Text, Text)

Returns the concatenation of two e-mail addresses separated by a comma.

The resulting list may then be used in the Send Email element or in the Send Email activity.

EmailAddressValidate(Text)

Returns True if the Address value you specify in the parameters is a valid e-mail address, or a list of valid e-mail addresses that can be used to send e-mails in the OutSystems Platform.

Environment Functions

Name

Description

GetApplicationServerType()

Returns the type of the application server where the module is running.

GetBrowserType()

Returns the type of the client browser in Web Flows.

Warning: this function is deprecated and will not be available in future versions of the OutSystems Platform. Please use the GetUserAgent function instead.

GetCurrentLocale()

Returns the current locale of the user session.

GetDatabaseProvider()

Returns the type of the OutSystems Platform Database where the module is running.

GetEntryEspaceId()

Returns the identifier of the module that is processing the current Web request.

GetEntryEspaceName()

Returns the name of the module that is processing the current Web request.

GetObsoloteTenantId()

Returns a fake identifier for single-tenant modules.

GetOwnerEspaceIdentifier()

Returns the identifier of the module that owns the element that is being processed.

GetUserAgent()

Returns the user agent in Web Flows, as indicated by the header of the HTTP message.

URL Functions

Name

Description

AddPersonalAreaToURLPath(Text)

When used in Web Flows, this function adds the Personal Area for the user name that is running the module to the URL path provided by the input parameter.

GetBookmarkableURL()

When used in Web Flows, this function returns the URL of the screen that is currently being processed in the web flow.

GetExceptionURL()

Returns the URL of the screen where the last exception was raised.

GetOwnerURLPath()

When used in Web Flows, this function returns the URL path of the module that owns the element that is being processed.

GetPersonalAreaName()

When used in Web Flows, this function returns the name of the Personal Area where the module is currently running. The name of the Personal Area is the user name that is running the module.

Miscellaneous Functions

Name

Description

CurrentThemeIsMobile()

Indicates if the current screen uses a mobile theme.

GeneratePassword(Integer, Boolean)

Generates a random string of a specified length.

If(Boolean,Text,Text)

Evaluates a condition, and returns a text according to the result of the evaluation.

IsLoadingScreen()

Indicates if the current web screen is a loading screen, instead of just re-rendered.

Roles Functions

Name

Description

CheckRole(EntityIdentifier, EntityIdentifier)

Returns True if the role specified in the input parameter has been granted to the specified end-user, otherwise it returns False.

See Also

Available Data types