The following operators are available: createday, createtimeofday, createtimestamp, addtimespan, addfactorytimespan, and weekday
Format conversion (date)
XML tag: |
createday |
|
Operands: |
exactly one value |
|
Synopsis: |
<createday> |
|
Operands: |
TIME (TIMESTAMP, DATE) |
|
Result: |
Value (date in dd.MM.yyyy format) |
|
Result type: |
DAY |
|
Description: |
Extracts a date from a PPM time stamp. |
|
Calculation (PPM3) |
Result |
Date returned by the operand |
Error |
If operand is of an invalid data type or equal to NULL |
|
Calculation (PPM4) |
Result |
Date returned by the operand NULL if operand is equal to NULL |
Error |
If operand is of an invalid data type |
|
Example: |
<calcattr name="AT_DAY" type="PROCESS"> |
Format conversion (time)
XML tag: |
createtimeofday |
|
Operands: |
exactly one value |
|
Synopsis: |
<createtimeofday> |
|
Operands: |
TIME (TIMESTAMP, DATE) |
|
Result: |
Value (time of the day in hh:mm:ss format) |
|
Result type: |
TIMEOFDAY |
|
Description: |
Extracts the time of day from a PPM time stamp. |
|
Calculation (PPM3) |
Result |
Time of the day defined by the operand |
Error |
If operand is of an invalid data type or equal to NULL |
|
Calculation (PPM4) |
Result |
Time of the day defined by the operand NULL if the operand returns NULL |
Error |
If operand is of an invalid data type |
|
Example: |
<calcattr name="AT_DAY" type="PROCESS"> nodetype="OT_FUNC" |
Format conversion (time stamp)
XML tag: |
createtimestamp |
|
Operands: |
one or two values (Date or Date and time) |
|
Synopsis: |
<createtimestamp> |
|
Operands: |
DAY, TIMEOFDAY |
|
Result: |
Value (time stamp in dd.MM.yyyy hh:mm:ss format) |
|
Result type: |
TIME (TIMESTAMP, DATE) |
|
Description: |
Creates a PPM time stamp from a date or from a date and a time. |
|
Calculation (PPM3) |
Result |
Time stamp defined by the operands |
Error |
If at least one operand is of an invalid data type or equal to NULL |
|
Calculation (PPM4) |
Result |
Time stamp defined by the operands. NULL if operand of DAY type returns NULL, or if first operand of TIMEOFDAY data type and second operand return NULL. |
Error |
If at least one operand is of an invalid data type |
|
Example: |
<createtimestamp> Creates the time stamp 25.01.2004 00:00:00. |
Addition of a time span
XML tag: |
addtimespan |
|
Operands: |
exactly two values (time stamp and time span, date and time span or time and time span) |
|
Synopsis: |
<addtimespan> |
|
Operands: |
Operand 1: TIME (TIMESTAMP, DATE) or DAY or TIMEOFDAY |
|
Result: |
Value (time stamp in dd.MM.yyyy hh:mm:ss format) |
|
Result type: |
Point in time: TIME (TIMESTAMP, DATE) or DAY or TIMEOFDAY |
|
Description: |
Adds a time span in the base scaling (SECOND) to a PPM time stamp. The result is a time stamp. |
|
Calculation (PPM3) |
Result |
Point in time resulting from adding the specified time span (operand 2) to the specified point in time (operand 1) |
Error |
If at least one operand equals NULL or at least one operand is of an invalid data type |
|
Calculation (PPM4) |
Result |
NULL if at least one operand is NULL Point in time resulting from adding the specified time span (operand 2) to the specified point in time (operand 1) |
Error |
If data type is invalid |
|
Example: |
<calcattr name="AT_NTOFD" type="PROCESS"> <calculation> <addtimespan> <constant> <dataitem> <datatype name="TIMEOFDAY"> </dataitem> </constant> </addtimespan> </calculation> </calcattr> At the specified time, a negative time span of thirty minutes is added. The result value 08:05:41 is saved in the AT_NTOFD target attribute. |
Addition of a time span including factory calendar
Adds a factory calendar time span to a PPM time stamp. The result is a time stamp. Configuration and usage of the addfactorytimespan operator are similar as for addtimespan. For this calculation, the specified factory calendar time span is added beginning from a start time. By default, the operator supports only addition of positive factory calendar time spans. If you also want to calculate points in time in the past, you can add negative time spans by specifying the optional XML attribute negfactorytimespan="TRUE" (default value: FALSE). If the point in time calculated is exactly on a work time limit the operator returns the earliest point in time possible.
Examples
Taking the simplified condition of a daily work time from 9am-5pm:
If you want to use a factory calendar other than the default factory calendar (factorycalendar.xml) you can specify an XML file containing the factory calendar to be used. In the attributename XML attribute, you specify the function or process instance attribute that determines the name of the XML factory calendar file to be used. The attribute must be specified at the function or process instance for which the calculation is run. In the XML attribute directory, you specify the directory in which to look for the specified factory calendar file. The two XML attributes attributename and directory must always be specified together.
You specify the corresponding directory containing the factory calendar file to be used relative to the PPM data directory. The PPM data directory data_ppm is located under <PPM installation directory>\ppmmashzone\server\bin\work\.
Example
...
<addfactorytimespan directory="calc\fc" attributename="AT_FC_NAME">
...
If the AT_FC_NAME attribute contains the value myFactoryCalendar.xml, the factory calendar defined in the file myFactoryCalendar.xml is used for calculation. The file is located under <PPM installation directory>\ppmmashzone\server\bin\work\data_ppm\calc\fc\.
The addition of factory calendar time spans is always in the base unit Person-second. The conversion factors used for this are independent of the factory calendar and defined in the client-specific configuration file transformationfactors.xml. If you do not want to use these, you may use only factory calendar time spans with the units person-second, minute, or hour to add a time span based on a factory calendar.
Determining the day of the week (from a date)
XML tag: |
weekday |
|
Operands: |
exactly one value |
|
Synopsis: |
<weekday> |
|
Operands: |
Exactly one operand: TIME or DAY |
|
Result: |
Character string in the format MO, TU, WE, TH, FR, SA, or SU |
|
Result type: |
TEXT |
|
Description: |
Determines the day of the week from a PPM date type and returns it as a character string. |
|
Calculation (PPM4) |
Result |
One of the constants MO, TU, WE, TH, FR, SA or SU, depending on the day of the week of the date transferred. |
Error |
If operand is of an invalid data type or an invalid number of operands. |
|
Example: |
<calcattr name="AT_WEEKDAY" type="PROCESS"> Determines the day of the week for the specified date ('Saturday') and returns it as the TEXT character string SA. Values of text dimensions that use results of the weekday operator cannot be sorted. |