Functions

The PSMI functions makes it possible to change the data sent to/from the M3 BE. Several functions can be called in a single @ARG/@RARG line: Separate the functions with a pipe sign | and the functions are called in continuation of each other. The available PSMI functions are described below:

BIT

The 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 in an @ARG and an @RARG line:

When used in a @RARG line the value of the M3 BE field is compared with the <Bit set value>. If they match then the bit <Bit number> is set in the M3 SWB field otherwise it is cleared.

When used in a @ARG line the value of bit <Bit number> in the M3 SWB field is examined. If the bit is set then the <Bit set value> is sent to M3 BE, otherwise the <Bit not set value> is sent. The type of the M3 SWB field has to be LONG or SHORT.

COUNT

The syntax of the COUNT function is:

COUNT(<offset>,<step>,<reset type>,<counter type>)

This function is used when you wish to use a counter as value for a column. The <offset> is the first value that is returned. The <step> is the value added to the counter each time it is used. These <reset types> are available:
  • Reset counter for each linked statement.
  • Reset counter for each statement.
  • Reset counter for each connection.
The <counter type> can be:
  • Statement counter
  • Argument counter

There can be only one statement counter for each statement and the definition of <offset>, <step> and <reset type> is taken from the first definition of the statement pointer. It is not changed when the statement pointer is specified on a linked statement. The argument pointer is used only for that argument. If a counter continues counting in linked statements, the statement counter has to be used.

MATH

The syntax of the MATH function is:

MATH(<Mathematical expression>)

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

These operators are available:
  • Addition ( + )
  • Subtraction ( - )
  • Multiplication ( * )
  • Division ( / )
  • Inversion ( ! )
  • Power ( ^ )

PMS2XD

This function converts a date value in internal M3 SWB format to a representation of a date value in the format YYYYMMDD. The type of the M3 SWB field has to be LONG.

PMS2XT

This function converts a time value in internal M3 SWB format to a representation of a time value in the format HHMMSS. The type of the M3 SWB field has to be a LONG.

TRANS

The syntax of the TRANS function is:

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

This function can transform 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 the function will instead return the [y]. The TRANS function can contain one or more TRANS pairs. You can write BLANK as a [x] value. This way a BLANK value can be transformed to another value. To transform a given value to a blank, you can write BLANK as the [y] value.

You can state a default value. This value is used if none of the TRANS pairs is concordant with 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 value on the format YYYYMMDD to internal M3 SWB format. The type of the M3 SWB field must be LONG.

XT2PMS

This function converts a time value on the format HHMMSS to internal M3 SWB format. The type of the M3 SWB field must be LONG.

XT2CH

This function converts a duration (time) value on the format HH.MM to centihours. The type of the M3 SWB field must be FLOAT.

CH2XT

This function converts a duration in centihours to the format HH.MM. The type of the M3 SWB field must be FLOAT.

MAX

The syntax of the MAX function is:

MAX(<Value>)

This function returns the maximum value of the input and the argument <Value>.

MIN

The syntax of the MIN function is:

MIN(<Value>)

This function returns the minimum value of the input and the argument <Value>.

ABS

This function returns the absolute value of the input to the function.

IF

The syntax of the IF function is:

IF(<Infor M3 BEfield name> <Operator> <Value>,<Value or action>)

The IF function compares the value of a M3 BE field with a value. If the result of this logical expression is true a value can be returned or an action can be performed.

The value can be:
  • A constant value
  • The value of a M3 BE field
  • BLANK

The available operators are: less than (<), less than or equal to (<=), greater than (>), greater than or equal to (>=), equal to (=) and not equal to (!=).

These actions are available:
  • SKIP

    The argument is skipped.

  • SKIPRECORD

    The entire record is skipped.

SUBSTR

The syntax of the SUBSTR function is:

SUBSTR(<from:to>)

The SUBSTR function can extract a sub-string that is specified by a from and a to position from a string.

COND

The syntax of the COND function is:

COND(<logical expression>)

To only evaluate an argument line if a given condition is fulfilled, use an argument condition. The logical expression is composed of criteria defined with the @CRITERION lines and the logical operators AND, OR and parentheses ( ). The criteria are referred to by the criterion number specified in the @CRITERION function.

CONFIG

The syntax of the CONFIG function is:

CONFIG(<mode>)

You can only evaluate an argument line if a given mode is active. This is controlled by the CONFIG function. These modes are available:
  • PWB

    PWB mode

  • SWB

    SWB mode

LZERO

This function adds leading zeros to a string.

ROUND

This function is used in an argument line to round off the values to the nearest integer.

UPPERCASE

This function is used to set the letters in a string to uppercase.

DECIMAL(n)

This function is used to lessen the number of decimals to the specified value in "n" for the number of decimal digits.

INDUSTRY(FASHION)

This function is used in an argument line as a command to skip the line in a parameter file if the values specified are not Fashion.

INDUSTRY(FOOD)

This function is used in an argument line as a command to skip the line in a parameter file if the values specified are not Food.

INDUSTRY(EQUIPMENT)

This function is used in an argument line as a command to skip the line in a parameter file if the values specified are not Equipment.

ADJUSTL

This function is used to adjust the string to the left.