Functions

The PSDB functions makes it possible to change the data to be sent to or the data retrieved from the database. The functions are placed in the functions element in the @COL and @WCOL lines. Several functions can be called in a single @COL/@WCOL line: Separate the functions with a pipe sign "|" and the functions are called in continuation of each other. The available PSDB functions are described below:
Function Description
BIT This syntax of the BIT function is:

BIT(<Bit number>,<Bit set value>,<Bit not set value>)

This result of this function depends on whether it is used during import or export:

When used during import the value of the database column field is compared with the <Bit set value>. If the match then the bit <Bit number> is set in the M3 PWB field otherwise it is cleared.

When used during export the value of bit <Bit number> in the M3 PWB field is examined. If the bit is set then the <Bit set value> is sent to the database, otherwise the <Bit not set value> is sent.

The type of the M3 PWB field has to be LONG or SHORT.

IFEMPTY This syntax of the IFEMPTY function is:

IFEMPTY (<value>)

This function converts an empty or blank value to another value. If the input to the function is empty or blank the argument value is returned instead. The type of the M3 PWB field must be CHAR.

LTRUNC This function removes leading blanks from a string. The type of the M3 PWB field must be CHAR.
MATH This syntax of the MATH function is:

MATH(<Mathematical expression>)

This function can make simple calculations using ordinary arithmetic operators. You can perform several calculations on the same data.

These operators are available:
  • Addition ( + )
  • Subtraction ( - )
  • Multiplication ( * )
  • Division ( / )
  • Inversion ( ! )
  • Power ( ^ )
  • Square root ( # )
PMS2XD This function converts a date value in internal M3 PWB format to a LONG representation of a date value in the format YYYYMMDD. The type of the M3 PWB field must be LONG.
PMS2XT This function converts a time value in internal M3 PWB format to a LONG representation of a time value in the format HHMMSS. The type of the M3 PWB field must be LONG.
RTRUNC This function removes trailing blanks from a string. The type of the M3 PWB field must be CHAR.
STRIP This function removes leading and trailing blanks from a string. The function combines the functionality of the LTRUNC and RTRUNC functions. The type of the M3 PWB field must be CHAR.
TRANS This syntax of the TRANS function is:

TRANS(x1,y1)(x2,y2)...(Default)

This function transforms data from one value to another value. The function compares the input to the function with the value stated as the x value in the syntax. If these two values match, then the function will instead return the y value. You can state a default value. The default value is used if none of the x values equals the input value. If a default value is stated it must be placed at the end of the TRANS function.

XD2PMS This function converts a date on the format YYYMMDD to internal M3 PWB format. The type of the M3 PWB field has to be LONG.
XT2PMS This function converts a time value on the format HHMMSS to internal M3 PWB format. The type of the M3 PWB field has to be LONG.
DECPCD This function converts a decimal point from "," to "." in a character representation of a decimal. The type of the M3 PWB field has to be CHAR.
DECPDC This function converts a decimal point from "." to "," in a character representation of a decimal. The type of the M3 PWB field has to be CHAR.