Base Rules
The base rules can be used with all process definitions that accept action rules. The result is stored in the RULE_RESULT
parameter.
CheckParameter
Check parameter for a specific numeric value. If no value is given, the compare value is 0
. The rule first searches an OUT parameter value. If it doesn't exist, it searches for an IN parameter with the name <parameter>
.
Syntax
CheckParameter(<parameter>,<check>[=<option>][,<rc>])
<parameter>
- Parameter name.<check>
- Check to perform if parameter value is numeric.EQ
- Equal compare parameter value with integer.NE
- Not Equal compare value with integer.GE
- Greater Equal compare parameter value with integer.LE
- Lower Equal compare value with integer.GT
- Greater then compare parameter value with integer.LT
- Lower then compare value with integer.
[=<option>]
- Option allows to specify what to compare to. If no option is specified, the compare value is0
.[<rc>]
- Return code to set (default = 4).
Example
CheckParameter(_RESULT,EQ=5,2)
CheckResultListSize
Check the size of the current result list. If the size is not as expected, a return code can be raised.
Syntax
CheckResultListSize(<size>[,[<check>],[<rc>],[<parameter>]])
<size>
- Result list size to check.<check>
- Check to perform on size.EQ
- Equal compare.NE
- Not Equal.GE
- Greater Equal.LE
- Lower Equal.GT
- Greater then.LT
- Lower then.
[<rc>]
- Return code to set (default = 4).[<parameter>]
- Parameter name.
Example
CheckResultListSize(3,EQ,8,BDC_QID)
CompareResultList
Compares the current result list with the value of a parameter. The differences are stored in a JobNote
Syntax
CompareResultList(<parameter>[,<option>])
<parameter>
- Parameter name (can be relative).[<option>]
- EQ (default) or NE.RULE_RESULT
- Merge record with found differences.
Example
CompareResultList(Step 1, job 1:_RESULT,NE)
ConvertResultList
Provides the option to convert the content of the result list. It can act on an element or on all records.
Syntax
ConvertResultList(<cmd>[=<option>][,<cmd>])
Meaning:
Convert the list of elements to NUMC format (number with leading zeros), return the maximum number, then add 1 to the element and return it as a result.
Input Parameters
ADD[=<int>]
- Add an integer to the selected element (if numeric).ADD_EMPTY[=<int>]
- Insert the specified number of empty fields in the record. The starting position can be defined using theFIELD=<int>
action.ADD_LIST[=<String>]]
- Insert each of the strings in the list as an extra field in the record. The position in the record of the new field is defined using theFIELD=<int>
action.AFTER=<String>
- Splits the selected element value and uses the last part.BEFORE=<String>
- Splits the selected element value and uses the first part.CONCAT=<int>
- Concatenate the specified source field with the current field (if not specified with the FIELD option, will affect the first position).COPY=<int>
- Copy from specified source field into the current field (if not specified with the FIELD option, will affect the first position).DUPLICATES
- Removes duplicate elements.FIELD=<int>
- Select the element for processing (default 1).FIELDS=<int>[,<int>]
- Reduces the elements in the records to the ones specified.FILL_FROM_PREVIOUS
- Fills field from previous record if it is empty.FORMAT_DATE=<String>,<String>
- Parses a date using the first format, and converts it to the second format.LEN=<int>
- Replace the selected element with a substring defined. If a negative length is specified, it is taken from the end.MAX[=<int>[,<int>]]
- Return only the numeric highest selected element result from all records. Field(s) can be specified to define the key for which the max is collected.MERGE=<int>[,<int>]
- Returns the comma separated merged result of the selected field by key.MIN[=<int>[,<int>]]
- Return only the numeric lowest selected element result from all records. Field(s) can be specified to define the key for which the max is collected.NUMC=<int>
- Convert the selected element to NUMC format of specified length (taken from end).POS=<String>
- Add string to the end of the selected element.PRE=<String>
- Add a string in front of the selected element (example PRE=! to exclude in selection).RANGE[=<int>[,<int>]]
- Return only the numeric range (<lowest>-<highest>
) of selected element result from all records. Field(s) can be specified to define the key for which the max is collected.REPLACE_ALL=<String>,<String>
- Replace all occurrences of the first string by the second in a record. Record position can be specified with theFIELD=<int>
option.REPLACE=<String>,<String>
- Replace the first occurrence of the first string by the second in a record. Record position can be specified with theFIELD=<int>
option.SELOPT
- Adds Select-Option brackets to the result or>!<
when the result is empty.SELOPT_OPTIMIZE
- Adds Select-Option brackets to result and optimizes the select option, creating ranges from distinct values.SET=<String>
- Set a fix value to the element.SUBTRACT=<int>
- Subtract an integer from the selected element.SUM[=<int>[,<int>]]
- Return the sum of the selected element from all records. Field(s) can be specified to define the key for which the max is collected.SWAP=<int>-<int>[,<int>-<int>]
- Swap elements in record.
note
Field specifications can be positive or negative (calculating from the end of the record).
Examples
Input | Command | Output | ||
---|---|---|---|---|
1,2,3 | ConvertResultList(ADD_EMPTY=2) | `;;1 | ;;2 | ;;3` |
1,2,3 | ConvertResultList(ADD_LIST=A,B,C) | `A;1 | B;2 | C;3` |
1,2,3 | ConvertResultList(ADD=1) | 2,3,4 | ||
Hello,World | ConvertResultList(AFTER=l) | lo,d | ||
Hello,World | ConvertResultList(BEFORE=l) | He,Wor | ||
1,2,3 | ConvertResultList(FIELD=1,CONCAT=1) | 11,22,33 | ||
1,2,3 | ConvertResultList(FIELD=1,COPY=1) | 1,2,3 | ||
11,12,13,14,13 | ConvertResultList(DUPLICATES) | 11,12,13,14 | ||
31,21,11 | ConvertResultList(FIELD=2) | 31,21,11 | ||
1234,123245,123 | ConvertResultList(FIELDS=1,2) | |||
121,12,345 | ConvertResultList(FIELD=2,FILL_FROM_PREVIOUS) | |||
12/22/16 | ConvertResultList(FORMAT_DATE=MM/dd/yy,dd-MM-yy) | 22-12-16 | ||
Hello,World | ConvertResultList(LEN=4) | Hell,Worl | ||
1,2,3 | ConvertResultList(MAX) | 3 | ||
1,2,3 | ConvertResultList(MERGE=1) | `1;1 | 2;2 | 3;3` |
1,2,3 | ConvertResultList(MIN) | 1 | ||
1,2,3 | ConvertResultList(NUMC=3) | 001,002,003 | ||
1,2,3 | ConvertResultList(POS=0) | 10,20,30 | ||
1,2,3 | ConvertResultList(PRE=!) | !1,!2,!3 | ||
1111,2111,3111 | ConvertResultList(RANGE=1,2,ADD=1) | |||
Hello,World | ConvertResultList(REPLACE=l, ) | Helo,Word | ||
Hello,World | ConvertResultList(REPLACE_ALL=l, m) | Hemmo,Wormd | ||
1,2,3 | ConvertResultList(SELOPT)* | [1,2,3] | ||
1,2,3 | ConvertResultList(SELOPT_OPTIMIZE)* | [1,2,3] | ||
1,2,3 | ConvertResultList(SET=123) | 123,123,123 | ||
1,2,3 | ConvertResultList(SUBTRACT=1) | 0,1,2 | ||
1,2,3 | ConvertResultList(SUM) | 6 | ||
1,2,3,4 | ConvertResultList(SWAP=1-4) | 1,2,3,4 |
The SELOPT
conversion will pass [1,2,3]
to the SAP system, SELOPT_OPTIMIZE
conversion will pass [1-3]
to the SAP System.
CopyFileAsTransactionOutput
Provides the option to copy output from a file (OS, Redwood Finance Automation document, or relative file name) to the current process. If the prefix is specified, only files with the prefix are considered.
Syntax
CopyFileAsTransactionOutput(<Output Selection>[,<prefix>])
<Output Selection>
- Source path (supports wildcards, asterisk (*
) and?
, on file name).[<prefix>]
- Prefix for file selection.
CopyFilsAsTransactionOutput(c:\temp\*.txt,TEXT_)
Example
CopyFilsAsTransactionOutput(c:\temp\*.txt,TEXT_)
CopyTransactionOutput
Provides the option to copy output from the process to a target directory.
Syntax
CopyTransactionOutput(<include>,<exclude>[,<target>])
<include>
- List with Outputs (supports wildcards, asterisk (*
) and?
).<exclude>
- List with Outputs to exclude (no wildcard logic).[<target>]
- Target Directory.
note
For <include>
and <exclude>
the general syntax of Output selection is used.
Example
CopyTransactionOutput(jcsOut.log,,C:/temp/${P:TASKLIST_YEAR}/P_${P:TASKLIST_PERIOD})
DeleteTransactionOutput
Provides the option to delete unwanted output from the process.
Syntax
DeleteTransactionOutput(source>[,<exclude>])
<source>
- List with Outputs (asterisks and ? can be used).[<exclude>]
- List with Outputs to exclude (no wildcard logic).
Example
DeleteTransactionOutput(stdout.log)
DisableMergeRecordOutput
If this rule is inserted at any point in the action rule sequence, the value of the out parameter RULE_RESULT
will be empty at the end of the rule executions.
Example
ALVColumnGet(, #1!,1,2,3,4,5);DisableMergeRecordOutput()
DisableRtxRecordOutput
If this rule is inserted at any point in the action rule sequence, the value of the out parameter RULE_RESULT_RTX
will be empty at the end of the rule executions.
Example
ALVColumnGet(, #1!,1,2,3,4,5);DisableRtxRecordOutput()
FilterResultList
Allows to filter the content of a result list. The rule returns the resulting list as merge records. If the <check>
parameter is used, a return code 4 is set in addition as soon as the check condition is met.
Syntax
FilterResultList([<check>,]<action>,<options>[,<option>])
[<check>]
.Empty
- Flag that generates RC=4 if action execution produces an empty list.NotEmpty
- Flag that generates RC=4 if action execution produces a non-empty list.NoForceCompleted
- Does not reset Error status of a process to Completed, ignoring the Empty or NotEmpty indicator.
<action><options>[,<option>]
Columns,<col>,<compare>,<col>
- Checks column<col>
against<col>
using operation and removes matching entries.ColZero,<col>,<compare>
- Checks column<col>
is empty/Zero using operation and removes matching entries.ColValue,<col>,<compare>,<text>[,<text>]
- Checks column<col>
for<text>
using operation and removes matching entries. More than one text can be specified. ForNE
andN_NE
anAND
compare is done, otherwise anOR
.First,<nr>
- Only keep the first<nr>
records from the result list.Last,<nr>
- Only keep the last<nr>
records from the result list.Parameter,<col>,<compare>,<parm>
- Check column<col>
and check against parameter<parm>
value. The parameter can be relative or named.
MyParameter
- General Compare Operations.
BT
- Column value is between<range>
.NB
- Column value is not between<range>
.CS
- Column value contains<text>
(case-insensitive).NCS
- Column value does not contain<text>
(case-insensitive).EW
- Column value ends with<text>
(trimmed).NEW
- Column value does not end with<text>
(trimmed).EQ
- Column value equals<text>
(trimmed).NE
- Column value not equal<text>
(trimmed).SW
- Column value starts with<text>
(trimmed).NSW
- Column value does not start with<text>
(trimmed).NEQ
- Column value equals<text>
(numeric).NNE
- Column value not equal<text>
(numeric).
- Additional compare operations for action Parameter.
IN
- Column value exists in parameter list or merge record.NIN
- Column value does not exist in parameter list or merge record.
Examples
FilterResultList(ColValue,3,EQ,Test)
- This removes the entry from the list if the 3rd column contains the text "Test".
INPUT: 1;1;Dev|2;2;Test
RESULT: 1;1;Dev
FilterResultList(ColValue,1,2,BT,aba..abz,xa..xd)
- Removes entry from the list if 1st or the 2nd column is between aba..abz or xa..xd.
INPUT: abcxx;a;b|c;aab;d;e|f;axx;g;h|xc;i;j;k;l|h;xa;mno;pqr;stu|xg;aaa;bbb;ccc;ddd
RESULT: c;aab;d;e|f;axx;g;h|xg;aaa;bbb;ccc;ddd
FilterResultList(ColValue,1,2,NB,10..20)
- Removes entry from the list if 1st or the 2nd column is not between 10
and 20
.
INPUT: 10;aa|20;bb|30;cc|40;dd
RESULT: 10;aa|20;bb
FindTextInOutput
Searches for a specified text in process output.
If the text is not found, a return code ( >0
) is generated. Likewise, if the text is found, the return code is set to 0
. This can be negated using the Operation Parameter.
Syntax
FindTextInOutput(<Output Selection>,<search>[,<operation>])
<Output Selection>
List of output.<search>
Text to be searched for. Regular expressions can be used. If nothing is specified, the parameterRULE_IN
is used to determine a search string.[<operation>]
OperationNOT
is supported and negates the RC determination. If the search is defined as a Regular expression, then the operation should beRegEx
.RULE_RESULT
List with output files where text was found.
Example
FindTextInOutput(stdout.log*,List Contains no data*)
Load
Retrieves the data transfer from the StorageId stored before.
Syntax
Load([[<cmd>,][<parameter>])
[<cmd>]
- Optional command.MERGE
- Merge existing result list with new result list.<storageId>
- StorageId used to store that Data Transfer.
Example
Load(Counter)
OutputDataTransferHtml
Stores the current data transfer as HTML output.
Syntax
OutputDataTransferHtml([<options>,][<title>],<column headers>])
<options>
- Optional parameters.FileName=<filename>
- Defines the Jobfile filename to be used, default: results.html.Body=<doc-htmltemplate-fullpath>
- Defines body template document full path, default: "doc:FCA:/FCA.FCA/FCA_Table_Template.txt".CSS=<doc-css-fullpath>
- Defines html style as CSS document full path, default: "doc:FCA:/FCA.FCA/FCA_MAIL_REPORT_CSS.txt".
<title>
- optional title, default: "Result List".<column headers>
- mandatory column header list for the table, for example "ca,cc,account,amount", works additionally as filter for the processed data. Filter function: only the rows were added to the result that have matching column count: input data: "1;2;3|4;5|6" will be filtered by "a;b" to "4;5", results.html:...<table> <tr><td>a</td><td>b</td></tr> <tr><td>4</td><td>5</td></tr> </table>.
...
Example
Input: "1;2|3;4"
OutputDataTransferHtml(,a,b)
Output: "...<table> <tr><td>a</td><td>b</td></tr> <tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr> </table>..."
Input: "1;2|3;4"
OutputDataTransferHtml(FileName=out.html,Body=doc:/HTML_Body.txt,CSS=doc:/CSS.txt,Testtitle,a,b")
Output: out.html: "...<table> <p>Testtitle</p> <tr><td>a</td><td>b</td></tr> <tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr> </table>..."
OutputDataTransferText
Print current content of Data Transfer as text into a JobFile.
Syntax
OutputDataTransferText(([[<filename>],[[<title>],[[<column headers>])
[FileName=<FileName>]
- Defines the FileName to be used. Defaultresults.txt
.[Title=<Title>]
- Defines the title shown. DefaultResult List
.[<Column Header>[,<Column Header>]]
- Column Header(s).
Example
OutputDataTransferText(cost_centers.txt,Cost Center Expenses,Cost Center, Amount, Currency)
ReadFileCsv
Read file content using separator into the result list. File can be an OS file, a relative JobFile, or Redwood Finance Automation document.
Syntax
ReadFileCsv([Skip=<int,>]<input>[,<separator>])
Skip=<int>
- Specify the number of lines to skip (optional).<input>
- Parameter name containing a list with jobfile names, Redwood Finance Automation documents, or<Output Selection>
as input references.[<separator>]
- separator to use (COMMA,COLON,BLANK,VERTICAL,SLASH,SEMICOLON,TAB). Default separator is COMMA.
Example
ReadFileCsv(upload1.dat)
ReadFileFixColumns
Read file content using fix columns which are specified in the file itself. File can be an OS file, a relative JobFile, or Redwood Finance Automation document.
Syntax
ReadFileFixColumns([Skip=<int>,]<input>,<header lines>,<column specification>)
Skip=<int>
- Specify the number of lines to skip (optional).<input>
- Parameter name containing a list with jobfile names or<Output Selection>
as input references.<header lines>
- Specifies the number of header lines to ignore.<column specification>
- Defines which line is the column definition line and what the separator is. Format:<line>=<separator>
.<separator>
- Separator to use (COMMA
,COLON
,BLANK
,VERTICAL
(pipe),SLASH
, orSEMICOLON
). Defaults to separator isCOMMA
.RULE_RESULT
- File content as text.
Example
ReadFileFixColumns(upload1.dat,2,2= ) uses two header lines and the 2nd line defines the column width using blank as separator.
ReadResultDocument
Retrieves the result list from a Document. This is required if rules are based on the results of a Redwood Script process. The value can be either a simple list or a record list.
Syntax
ReadResultDocument([<cmd>,][<parameter>])
[<cmd>]
- Optional command.Merge
- Merge existing result list with new result list.[<document>]
- Document name or full path.RULE_RESULT
- Value of specified parameter.
Example
ReadResultDocument(doc:FCA:/FCA.FCA/FCA.FCA_FCc/FCA.CUS_FCA_FCc_Data/CUS_0001_MAINT.txt)
ReadResultList
Retrieves the result list from a Parameter. This is required if rules are based on the results of a Redwood Script process. The value can be either a simple list or a record list.
Syntax
ReadResultList([Merge,][Update,][<parameter>])
[<cmd>]
- Optional command.Merge
- Merge existing result list with new result list.Update
- Store the result of the data transfer in parameterRULE_RESULT
.[<parameter>]
- Parameter name (can be relative). Default isRULE_RESULT
.RULE_RESULT
- Value of specified parameter.
Example
ReadResultList(Counter)
SetTaskStatus
Set the process status to a specific RC or to the status of a relative process.
Syntax
SetTaskStatus(<action>)
<action>
Completed[,<rc>]
- Set Status to Completed (optionally return code can be set).Error[,<rc>]
- Set Status to Error (optionally return code can be set).Abend[,<rc>]
- Set Status to Abend (optionally return code can be set).Skipped[,<rc>],<Rel Process>[!<Rel Process Definition]
- Set Status to Error (with optional return code) when all relative processes are skipped.MapRc,<trgRc>,<rc>[,rc]
- Map ReturnCodes to Target return code.<Rel Process>[|<Rel Process>]
- List of relative process definitions (<step_name>, {{J|j}ob|{P|p}rocess} <process_number_in_step>
, exampleStep 1, job 1
orMy specific step, process 4
).
Example
SetTaskStatus(Step 1, Job 1)
SetTransactionStatus
Change the process status and/or set a specific ReturnCode.
Syntax
SetTransactionStatus (<action>)
<action>
Completed[,<rc>]
-Set Status to Completed (optionally return code can be set).Error[,<rc>]
- Set Status to Error (optionally return code can be set).Abend[,<rc>]
- Set Status to Abend (optionally return code can be set).MapRc,<trgRc>,<rc>[,rc]
- Map ReturnCodes to Target return code.
Example
SetTransactionStatus(Abend)
Store
Stores the current Data Transfer into a temporary storage ID.
Syntax
Store([<condition>,][<action>,]<storageId>)
[<condition>]
COMPLETED
- Execute only if the process has status Completed.ERROR
- Execute only if the process has status Error.RC=<rc>
- Execute only if the process return code matches.
[<action>]
MIN
- Sets the minimum value of the result list and current value.MIN=<field>
- Sets the minimum value for the specified field in record comparing the result list and current value.MAX
- Sets the maximum value of the result list and current value.MAX=<field>
- Sets the maximum value for the specified field in record comparing the result list and current.MERGE
- Merges the result with an existing value.
<storageId>
- ID this data transfer is stored under.
Example
Store(MERGE,Counter)
TaskDetails
Provides the details of the current process in list form. This includes the steps, processes, parameter, dependencies and restart information. Optionally a process ID can be passed as parameter. It will be used as the top process to be used for the list.
Syntax
TaskDetails([<process_ID>])
[<process_ID>]
ID of a process. Default is the current process.
Example
TaskDetails()
UpdateDocument
Updates a document with the results of the Rule Result parameter, which was set from a previous action rule execution.
Syntax
UpdateDocument([[<condition>,][[<merge>,]<document>)
[<condition>]
COMPLETED
Execute only if the process has status Completed.ERROR
Execute only if the process has status Error.RC=<rc>
Execute only if the process return code matches.
[<merge>] MERGE
Merges the result with an existing value.<document>
Target Document name or full path.
note
If full path is used and the document does not exist, then it is created using the name (Data application).
If the document does not exist, it is created.
Example
UpdateDocument(MERGE,Test_Doc)
UpdateParameter
Updates a process parameter with values
Syntax
UpdateParameter([<condition>][,<option>][,<action>],<trg_parm>[,<src_parm>])
[<condition>]
COMPLETED
- Execute only if the process has status Completed.ERROR
- Execute only if the process has status Error.RC=<rc>
- Execute only if the process return code matches.
[<option>]
MERGE
- Merges the result from rules with an existing source and target values.DUPLICATES
- Removes duplicates from result stored.
[<action>] MIN
- Sets the minimum value of the result list and current value.MIN=<field>
- Sets the minimum value for the specified field in record comparing the result list and current value (if merge is defined).MAX
- Sets the maximum value of the result list and current value (if merge is defined).MAX=<field>
- Sets the maximum value for the specified field in record comparing the result list and current (if merge is defined).FIRST
- Sets the first value of the result list and current value(if merge is defined).FIRST=<field>
- Sets the first value for the specified field in record comparing the result list and current (if merge is defined).LAST
- Sets the last value of the result list and current value (if merge is defined).LAST=<field>
- Sets the last value for the specified field in record comparing the result list and current (if merge is defined).FIELD=<field>
- Defines the field to be retrieved in Record.
<trg_parm>
- Target Parameter name (can be relative). If empty,RULE_RESULTS
is used.[<src_parm>]
- Source Parameter(s) name (can be relative). Use|
to separate multiple source parameters.
Example
UpdateParameter (MERGE,Counter,Test_Source)
UpdateVariable
Updates a variable in the cross system variables table (FCA_Variables
) from the result list or from a source parameter with the Rule Result.
Syntax
UpdateVariable([<condition>,][<action>,]<variable>[,<src_parm>])
[<condition>]
COMPLETED
- Execute only if the process has status Completed.ERROR
- Execute only if the process has status Error.RC=<rc>
- Execute only if the process return code matches.
[<action>]
MIN
- Sets the minimum value of the result list and current value.
MIN=<field>
- Sets the minimum value for the specified field (starting with field 1) in record comparing the result list and current value.MAX
- Sets the maximum value of the result list and current value.MAX=<field>
- Sets the maximum value for the specified field (starting with field 1) in record comparing the result list and current value.MERGE
- Merges the result with an existing value.<variable>
- Variable name in table.[<src_parm>]
- Source Parameter name (can be relative).
Example
UpdateVariable(COMPLETED,MIN=2,MinPosting)
with input "abc;1000;33|def;900;44|ghi;1200;22", and table entry value = "5000"
results to an updated table entry value = "900"
WriteFileCsv
Write file content using separator from the result list.
Syntax
WriteFileCsv([path,]<separator>,<output>)
path
- flag (case-insensitive) to have theRULE_RESULT
parameter contain the path to the csv file.<separator>
- Separator to use (COMMA
,COLON
,BLANK
,VERTICAL
,SLASH
,SEMICOLON
,TAB
).<output>
- Filename to be used.RULE_RESULT
- the path of the created file.
Example
WriteFileCsv(TAB,output.csv)
WriteFileCsv(PATH,COLON,report.csv)
ZipTransactionOutput
Copies or moves output from the process to a Zip file in the current process.
Syntax
ZipTransactionOutput(<zipName>,<include>,<exclude>[,<delete>])
<zipName>
- Name of the zip file.<include>
- List of files to include.[<exclude>]
- List of files to exclude.[<delete>]
- Delete the selected files after adding them to the zip file. Possible values:false
(effectively acopy
) ortrue
(effectively amove
).
note
For <include>
and <exclude>
the general syntax of Output selection is used.
Example
ZipTransactionOutput(output_all.zip*,*)
financeTopic