Expression Functions

This section lists the built-in functions of the Expression Language.

length(str)

Returns the length of a given string.

Parameter(s):

  • str: STRING
    The string that should be measured

Return type: ÌNTEGER

Examples:

length('hello world') // returns 11
length('')  // returns 0

isEmpty(str)

Test if a given string value is empty, i.e., length // returns 0

Parameter(s):

  • str: STRING
    The string to check if empty

Return type: BOOLEAN

Examples:

isEmpty('') // returns true
isEmpty('hello world') // returns false

isDefined(str)

Test if a given string value is non-empty, i.e., length > 0

Parameter(s):

  • str: STRING
    The string to check if defined

Return type: BOOLEAN

Examples:

isDefined('') // returns false
isDefined('hello world') // returns true

currentDate()

Returns the current date in the time zone of the server machine.

Return type: DATE

Examples:

currentDate() // returns e.g., 4/8/24

userDate()

Returns the current date in the time zone of the client machine.

Return type: DATE

Examples:

userDate() // returns e.g., 4/8/24

date(year,month,day)

Constructs a date value for the given year, month and day.

Parameter(s):

  • year: INTEGER
    The year of the new date
  • month: INTEGER
    The month of the new date
  • day: INTEGER
    The day of the new date

Return type: DATE

Examples:

date(1977, 8, 17) // returns 8/17/77
date(-1, -1, -1) // returns nulldate

day(date)

Returns the day of the given date.

Parameter(s):

  • date: DATE
    The date from which a day is derived

Return type: INTEGER

day(date(1977, 8, 17)) // returns 17

month(date)

Returns the month of the given date.

Parameter(s):

  • date: DATE
    The date from which a month is derived

Return type: INTEGER

month(date(1977, 8, 17)) // returns 8 // returns 8

year(date)

Returns the year of the given date.

Parameter(s):

  • date: DATE
    The date from which a year is derived

Return type: INTEGER

year(date(1977, 8, 17)) // returns 1977

addPeriod(date,years,months,days)

Add or subtract a period from a given date.

Parameter(s):

  • date: DATE
    The date to add or subtract a period to
  • years: INTEGER
    The number of years to add/subtract
  • months: INTEGER
    The number of months to add/subtract
  • days: INTEGER
    The number of days to add/subtract

Return type: DATE

addPeriod(date(1977, 8, 17), 1, 2, 3) // returns 10/20/78
addPeriod(date(1977, 8, 17), -1, -2, -3) // returns 6/14/76

addYears(date,years)

Add or subtract a given number of years from a given date.

Parameter(s):

  • date: DATE
    The date to add or subtract a period to
  • years: INTEGER
    The number of years to add/subtract

Return type: DATE

addYears(date(1977, 8, 17), 1) // returns 8/17/78
addYears(date(1977, 8, 17), -1) // returns 8/17/76

addMonths(date,months)

Add or subtract a given number of months from a given date.

Parameter(s):

  • date: DATE
    The date to add or subtract a period to
  • months: INTEGER
    The number of months to add/subtract

Return type: DATE

addMonths(date(1977, 8, 17), 1) // returns 9/17/77
addMonths(date(1977, 8, 17), -1) // returns 7/17/77

addDays(date,days)

Add or subtract a given number of days from a given date.

Parameter(s):

  • date: DATE
    The date to add or subtract a period to
  • days: INTEGER
    The number of days to add/subtract

Return type: DATE

addDays(date(1977, 8, 17), 1) // returns 8/18/77
addDays(date(1977, 8, 17), -1) // returns 8/16/77

format(date,formatStr)

Format a given date using a given format See Kendo-Intl for formatopen in new window

Parameter(s):

  • date: DATE
    The date to format as a string
  • formatStr: STRING
    The date format to apply

Return type: STRING

format(date(1977, 8, 17), 'dddd, MMMM Do yyyy') // returns 1717, August Do 1977

isEnvVarDefined(path)

Test if a given environment path exists for the current user.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: BOOLEAN

isEnvVarDefined('user.info.companynumber') // returns true
isEnvVarDefined('does.not.exist') // returns false

amountEnvVar(path)

Returns the amount value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: AMOUNT

amountEnvVar('some.amount.environment.variable') // returns 12312 (corresponds to 123.12)

booleanEnvVar(path)

Returns the boolean value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: BOOLEAN

booleanEnvVar('some.boolean.environment.variable') // returns true

dateEnvVar(path)

Returns the date value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: DATE

dateEnvVar('some.date.environment.variable') // returns 8/17/77

integerEnvVar(path)

Returns the integer value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: INTEGER

integerEnvVar('some.integer.environment.variable') // returns 123

popupEnvVar(path)

Returns the popup value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: POPUP

popupEnvVar('some.popup.environment.variable') // returns somePopupLiteral

realEnvVar(path)

Returns the real value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: REAL

realEnvVar('some.real.environment.variable') // returns 3.14

stringEnvVar(path)

Returns the string value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: STRING

stringEnvVar('some.string.environment.variable') // returns 'some string'

timeEnvVar(path)

Returns the time value stored in the current user's environment.

Parameter(s):

  • path: STRING
    The path that identifies the environment value

Return type: TIME

timeEnvVar('some.time.environment.variable') // returns '12:12:12'

amountSysPar(param,companyNo?)

Returns the amount value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: AMOUNT

amountSysPar('some.amount.system.parameter', '117') // returns 12312 (corresponds to 123.12)

booleanSysPar(param,companyNo?)

Returns the boolean value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: BOOLEAN

booleanSysPar('some.boolean.system.parameter', '117') // returns true

dateSysPar(param,companyNo?)

Returns the date value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: DATE

dateSysPar('some.date.system.parameter', '117') // returns 8/17/77

integerSysPar(param,companyNo?)

Returns the integer value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: INTEGER

integerSysPar('some.integer.system.parameter', '117') // returns 117

popupSysPar(param,companyNo?)

Returns the popup value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: POPUP

popupSysPar('some.popup.system.parameter', '117') // returns somePopupLiteral

realSysPar(param,companyNo?)

Returns the real value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: REAL

realSysPar(p'some.real.system.parameter', '117') // returns 3.14

stringSysPar(param,companyNo?)

Returns the string value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: STRING

stringSysPar('some.string.system.parameter', '117') // returns 'some string'

timeSysPar(param,companyNo?)

Returns the time value stored in a given system parameter. If a company-specific value is required, a company number can be supplied as an optional second argument.

Parameter(s):

  • param: STRING
    The system parameter name
  • companyNo: STRING optional
    The number of the company, in case a company-specific value is required

Return type: TIME

timeSysPar('some.time.system.parameter', '117') // returns '12:12:12'

employeeNumber()

Returns the employee number of the current user.

Return type: STRING

employeeNumber() // returns '11'

employeeName()

Returns the employee name of the current user.

Return type: STRING

employeeName() // returns 'Jim Jarrett'

companyNumber()

Returns the company number of the current user.

Return type: STRING

companyNumber() // returns '123'

hasRole(...role)

Test if the current user has any of the given roles. If multiple roles are supplied as arguments then the function returns true if the user is assigned any of these roles. Roles in Maconomy refer to the contents of the user.groups.groupname array in the end-user's environment.

Parameter(s):

  • role: STRING (or a comma-separated list of roles)
    The name(s) of the role(s) to check for.

Return type: BOOLEAN

hasRole('Change Password') // returns true
hasRole('A', 'B') // returns false

isAdministrator()

Test if the current user is an administrator.

Return type: BOOLEAN

isAdministrator() // returns true

hasAddon(addonNo)

Test if a given addon number is enabled.

Parameter(s):

  • addonNo: INTEGER
    The number of the addon to check for.

Return type: BOOLEAN

hasAddon(1) // returns true
hasAddon(66) // returns true

urlInfoView()

Returns the Business Objects Info View URL.

Return type: STRING

urlInfoView() // returns '/BOE/portal/1205291547/InfoView/logon/start.do'

urlOpenReport()

Returns the Business Objects Open Report URL.

Return type: STRING

urlOpenReport() // returns '/BOE/OpenDocument/opendoc/openDocument.jsp'

localizeDbString(str)

Returns the DB localized value for a given key. This is done through a lookup in the user's environment.

Parameter(s):

  • str: STRING
    The string that should be localized using the environment.

Return type: STRING

localizeDbString('BPM.CustomerInvoices') // returns 'Customer Invoices'

popupOrdinal(popup)

Returns the ordinal value of a given Maconomy popup value.

Parameter(s):

  • popup: POPUP
    The popup value from which an ordinal value should be derived.

Return type: INTEGER

popupOrdinal(CompanyCountryVar) // returns 1
popupOrdinal(CountryType'\United Kingdom\) // returns 2

shortname()

Returns the shortname of the system.

Return type: STRING

shortname() // returns 'w22'

username()

Returns the username of the current user.

Return type: STRING

username() // returns 'Administrator'

userrole()

Returns the user role of the current user.

Return type: STRING

userrole() // returns 'Standard'

isLongTextEmulationEnabled()

Returns true if long text emulation is enabled.

Return type: BOOLEAN

isLongTextEmulationEnabled() // returns false

isPeoplePlannerEnabled()

Returns true if people planner integration is enabled.

Return type: BOOLEAN

isPeoplePlannerEnabled() // returns true