Formula Functions
You use functions to perform specific tasks that facilitate data processing for the reports. Many functions available in the Analytical Report Manager process the data selected from the data source and return the values to be used in the report.
To use functions in the formula, you can enter them directly in the formula editing area or select them from the list of functions provided in the Formula Editor dialog box (Formulas).
The groups of functions in the formulas are described below.
Conversion Functions
You use conversion functions, summarized in the following table, to convert data from one data type to another.
Function | Description and Examples |
---|---|
CBool(x) |
Converts an expression defined in a function argument into the Boolean expression. If the
expression's values is 0, False is returned;
otherwise, True is
returned.
The return type is
Example:
|
CDate(x) |
Converts an expression defined in a function argument to a value of the Date type.
The CDate function argument should be a valid date
expression. CDate recognizes date formats according to
the locale setting of the system. The return type is
Example:
|
CStr(x) |
Converts an expression defined in a function argument to a string. If the CStr
function argument equals null, CStr returns a
run-time error; otherwise, it returns a string of characters.
The return type is Example:
|
CDbl(x) |
Converts an expression defined in a function argument to a value of the Double
type. The return type is Example:
|
CSng(x) |
Converts an expression defined in a function argument to a value of the Single
type. If the expression defined in the function argument lies
outside the acceptable range for the Single type, an
error occurs. The return type is
Example:
|
CDec(x) |
Converts an expression defined in a function argument to a value of the Decimal
type. The return type is Example:
|
CInt(x) |
Converts an expression defined in a function argument to a value of the Integer
type. The return type is Example:
|
CShort(x) |
Converts a numeric value to a value of the Short type. The return type is
Example:
|
CLong(x) |
Converts a numeric value to a value of the Long type. The return type is
Example:
|
Text Functions
Text functions, described in the following table, are used to perform operations with text strings.
Function | Description and Examples |
---|---|
LTrim(string) |
Removes all leading spaces or parsing characters from the specified character expression,
or all leading 0 bytes from the specified binary
expression. The return type is Example:
|
RTrim(string) |
Removes all trailing spaces or parsing characters from the specified character
expression, or all trailing 0 bytes from the specified
binary expression. The return type is
Example:
|
Trim(string) |
Removes all leading and trailing spaces or parsing characters from the specified
character expression, or all leading and trailing 0 bytes
from the specified binary expression. The return type is
Example:
|
Format(format, argument(s)) |
Replaces the format item in a specified formatting string (format) with the text
equivalent of the arguments (arguments). The return type
is Example:
|
UCase(string) |
Returns a string that has been converted to uppercase. The string argument is any
valid string expression. The return type is
Example:
|
LCase(string) |
Returns a string that has been converted to lowercase. The string argument is any
valid string expression. The return type is
Example:
|
InStr(string, findString) |
Returns the position of the first occurrence of one string (findString) within
another (string). The return type is
Example:
|
InStrRev(string, findString) |
Returns the position of the last occurrence of one string (findString) within
another (string), starting from the right side of the
string. The return type is Example:
|
Len(string) |
Returns an integer containing either the number of characters in a string or the nominal
number of bytes required to store a variable. The return type is
Example:
|
Left(string, length) |
Returns a string containing a specified number of characters from the left side of a
string. The return type is Example:
|
Right(string, length) |
Returns a string containing a specified number of characters from the right side of a
string. The return type is Example:
|
Replace(string, oldValue, newValue) |
Returns a string in which a specified substring (oldValue) has been replaced with
another substring (newValue). The return type is
Example:
|
PadLeft(string, width, paddingChar) |
Right-aligns the characters in a specified string (string), padding with the
specified characters (paddingChar) on the left for a
specified total width (width). The return type is
Example:
|
PadRight(string, width, paddingChar) |
Left-aligns the characters in a specified string (string), padding with the
specified characters (paddingChar) on the right for a
specified total width (width). The return type is
Example:
|
Math Functions
Mathematical functions, described in the following table, perform calculations, usually based on input values provided as arguments, and return numeric values.
Function | Description and Examples |
---|---|
Abs(x) |
Returns the absolute value of a number. Example:
Here A10 and B10 are the links used in a function argument. |
Floor(x) |
Returns the largest integer that is not greater than the argument. Example:
Here A10 and A12 are the links used in a function argument. |
Ceiling(x) |
Returns the smallest integer that is not less than the argument. Example:
Here A10 and C11 are the links used in a function argument. |
Round(x, decimals) |
Returns a numeric expression, rounded to the specified precision (decimals). Example:
Here A10 and B12 are the links used in a function argument, and 5 is the number of digits after the decimal separator. |
Min(x, y) |
Returns the smaller of the two values. Example:
Here A10 and A12 are the links used as function arguments) |
Max(x, y) |
Returns the greater of the two values. Example:
Here A12 and A14 are the links used as function arguments. |
Pow(x, power) |
Computes the value of x raised to the specified power (power). Example:
Here A12 is the link used as a function argument, and 2 is the power index. |
Date and Time Functions
The date and time functions, described below, perform operations on input values and return values of the following types: string, numeric, or date and time.
Function | Description and Examples |
---|---|
DateAdd(date, interval, number) |
Returns a new date, which is calculated by adding the
specified number (number) of time intervals (interval) to the date
(date). The interval argument specifies the type of time interval and
can be one of the following options:
The return type is Example:
|
DateDiff(interval, date1, date2) |
Returns
the count (as a signed integer value) of the specified interval boundaries that
are crossed between the specified date1 and date2. The interval
argument, which specifies the type of time interval, can be one of the following
options:
The return type is |
Day(date) |
Returns the day component of the date. The return type is
Example:
|
DayOfWeek(date) |
Returns the day of week for the date. The return type is
Example:
|
DayOfYear(date) |
Returns the day of the year for the date. The return type is
Example:
|
DayOrdinal(day) |
Converts the specified integer value (day) to a string that contains the ordinal number in the current locale. For example, for the English locale, the string contains the short form of the ordinal number, such as 1st or 2nd. For numbers that are less than 1 or greater than 31, the function returns an empty string. The return type is Example:
|
Hour(date) |
Returns the hours of the date. The return type is Example:
|
Minute(date) |
Returns the minutes of the date. The return type is Example:
|
Month(date) |
Returns the month component of the date. The return type is
Example:
|
MonthName(date) |
Returns a string that contains the name of the month extracted from the specified date (date) in the current locale. The return type is Example:
|
Now() |
Returns the business date and time according to the system date and time on the local
computer. The return type is Example:
|
NowUTC() |
Returns the business date and time in the user's time
zone. The system extracts the user's time zone from one of the following sources, which
are ordered by priority from the highest to the lowest:
The return type is Example:
|
Second(date) |
Returns the seconds of the date. The return type is
Example:
|
Today() |
Returns the business date according to the system date and time on the local computer.
The return type is Example:
|
TodayUTC() |
Returns the business date in the user's time zone. The
system extracts the user's time zone from one of the following sources, which are
ordered by priority from the highest to the lowest:
The return type is Example:
|
Year(date) |
Returns the year component of the date. The return type is
Example:
|
Other Functions
The Other functions group includes the following functions.
Function | Description and Examples |
---|---|
IIf(expression, truePart, falsePart) |
Returns one of two values, depending on the evaluation
of the expression: If the expression evaluates to The return type is determined by the value that the function returns. Example:
You can also use this function to set a field value to NULL. Example:: |
IsNull(value, nullValue) |
Returns nullValue if value is NULL; otherwise, returns value. The return type is determined by the value that the function returns. Example:
|
NullIf(value1, value2) |
Returns NULL if value1 is equal to value2. |
Sort(from, to, column) |
Returns the values in the specified range of rows in the specified column sorted in ascending order. Example:
|
SortD(from, to, column) |
Returns the values in the specified range of rows in the specified column sorted in descending order. Example:
|
Sum(from, to) |
Returns the sum of the values in the specified interval. The return type is determined by the value that the function returns. Example:
|
Switch(expression_1, value_1, expression_2, value_2, ...) |
Returns the value (value_n) that corresponds to
the first expression (expression_n) that evaluates to The return type is determined by the value that the function returns. Example:
|
Application-Specific Functions
This functions are specific for MYOB Acumatica.
Function | Description and Examples |
---|---|
ExtToInt(object field, object value) | Converts the external format of the object field parameter into the internal object presentation (for example, converts AccountCD to AccountID). Both arguments of the ExtToInt function must have the same data type. Example::=Report.ExtToInt( 'ARAdjusted.AdjdCustomerID',
[ARAdjusted.AdjdCustomerID]) |
ExtToUI(object field, object value) | Converts the external format of the object field parameter into the UI format. Both arguments of the ExtToUI function must have the same data type. Example:=Report.ExtToUI('RowBatch.TranPeriodID', @PeriodID)
|
GetBranchText(branchID) |
Returns the branch name in the tenant for the specified branch identifier (branchID). If the specified branch identifier does not exist, the function returns an empty string. Example:
|
GetDefExt(object field) | Gets the default value of the object field parameter in the external format. Example:=Report.GetDefExt('OrganizationBranchReportParameters.OrganizationID') |
GetDefInt(object field) | Gets the default value of the object field parameter in the internal format. |
GetDefUI(object field) | Gets the default value of the object field parameter in the UI format. Example:=Report.GetDefUI('RowAccessInfo.DisplayName') |
GetDescription(object field, object value) | Returns the description of the object field parameter as it is defined in the PXSelectorAttribute. Both arguments of the GetDescription function must have the same data type. Example::=Report.GetDescription('GLTran.AccountID',
@AccountCD) Attention: If you use this
function for subaccounts, the subaccount description is not
available if the By Segment: All Avail. Segment Values
lookup mode is specified for the SUBACCOUNT segmented key
on the Segmented Keys (CS202000)
form. |
GetDisplayName(object field) |
Returns the localized name of the object field parameter. |
GetFormat(object field) | Returns the data type of the object field parameter. Example:=Report.GetFormat( [APRegister.CuryInfoID]
) |
GetMask(object field) | Returns the mask of the object field parameter. Example:
=Report.GetMask('RowTaxPeriodEffective.TaxPeriodID') |
IntToExt(object field, object value) |
Converts the external format of the object field parameter into the internal object presentation (for example, converts AccountID to AccountCD). Both arguments of the IntToExt function must have the same data type. |
IntToUI(object field, object value) | Converts the internal format of the object field parameter into the UI format. Both arguments of the IntToUI function must have the same data type. Example:=Report.IntToUI('APRegister.FinPeriodID',$ClosedPer) |
UIToExt(object field, object value) |
Converts the UI format of the object field parameter into the external object format. Both arguments of the UIToExt function must have the same data type. |
UIToInt(object field, object value) |
Converts the UI format of the object field parameter into the internal object format. Both arguments of the UIToInt function must have the same data type. |
FormatPeriod(object period) |
Performs ExtToUI data conversion for the object period parameter. This function is used to get the period defined by the report's @StartPeriod and @EndPeriod dates. |
FormatPeriod(object period, object period shift) |
Performs ExtToUI data conversion for the object period parameter with a time shift defined by object period shift argument. This function is used to get the period defined by the report's @StartPeriod and @EndPeriod dates. |
FormatYear(object period) |
Performs ExtToUI data conversion for the object period parameter year part. This function is used to get the period defined by the report's @StartPeriod and @EndPeriod dates. |
FormatYear(object period, object period shift) | Performs ExtToUI data conversion for the object period parameter year part with a time shift defined by object period shift argument. This function is used to get the period defined by the report's @StartPeriod and @EndPeriod dates. Example:=FormatYear(@StartPeriod, -1) (The function obtains
the year of the specified period and shifts the obtained year to the
value of the shift. For example, if the @StartPeriod is the year
2014, the expression returns 2013.) |