Creating the XML file: Examples
The following is the format of a valid XML rule file:
<?xml version="1.0"?>
<KN-RULESPACE>
<RULE>
{definition of rule}
</RULE>
<RULE>
{definition of rule}
</RULE>
</KN-RULESPACE>
The following examples show a drill as defined in a .sr file, followed by the same drill defined as XML.
Example of a Select:
DEFINE SELECT "Workers Comp Class"
ID HR-WCC-S-0089
SCRFLD WC-CLASS
FILENAME WCCLASS
INDEX WCCSET2
KEYRNG COMPANY-01
NXTKEY WC-CLASS
CONDITION US
DSPFLDS WC-CLASS:"WC Class", WC-STATE:"State",
PROCESS-LEVEL:"P/L", EFFECT-DATE:"Eff Date", DESC:"Description"
RETURNS WC-CLASS
RETURNS WC-STATE into WC-STATE
RETURNS PROCESS-LEVEL into PROCESS-LEVEL
RETURNS EFFECT-DATE into EFFECT-DATE
The following is the same rule definition when done in XML:
<RULE>
<SELECT file="WCCLASS" index=WCCSET2" id="HR-WCC-S-0089"
title="Workers Comp Class" >
<TRIGGERS>
<TRIGGER value="WC-CLASS" />
</TRIGGERS>
<KEY-LIST>
<RULE-KEY value="COMPANY-01" />
</KEY-LIST>
<CONDITIONS>
<CONDITION value="US" />
</CONDITIONS>
<DISPLAY-FIELDS>
<DISPLAY-FIELD name="WC-CLASS" label="WC Class" />
<DISPLAY-FIELD name="WC-STATE" label="State" />
<DISPLAY-FIELD name="PROCESS-LEVEL" label="P/L" />
<DISPLAY-FIELD name="EFFECT-DATE" label="Eff Date" />
<DISPLAY-FIELD name="DESC" label="Description" />
</DISPLAY-FIELDS>
<RETURN-FIELDS>
<RETURN-FIELD source="WC-CLASS" />
<RETURN-FIELD source="WC-STATE" target="WC-STATE" />
<RETURN-FIELD source="PROCESS-LEVEL" target="PROCESS-LEVEL" />
<RETURN-FIELD source="EFFECT-DATE" target="EFFECT-DATE" />
</RETURN-FIELDS>
</SELECT>
</RULE>
Example of a Function:
DEFINE FUNCTION COUNTRY-SUF()
FILENAME HRCTRYCODE
INDEX CTCSET2
KEYRNG "SU",HCP-NAME-SUFFIX
RETURNS COUNTRY-CODE
<RULE>
<FUNCTION file="HRCTRYCODE" index="CTCSET2" id="COUNTRY-SUF()" >
<KEY-LIST>
<LITERAL-VALUE value="SU" />
<RULE-KEY value="HCP-NAME-SUFFIX" />
</KEY-LIST>
<RETURN-FIELDS>
<RETURN-FIELD source="COUNTRY-CODE" />
</RETURN-FIELDS>
</FUNCTION>
</RULE>
Example of a Field Exit:
DEFINE RULE
ID HR-PRS-R-0013
SCRFLD COMPANY-01
FILENAME PRSYSTEM
INDEX PRSSET1
KEYRNG COMPANY-01, ~SPACES
RETURNS NAME into HR-COMPANY-NAME
<RULE>
<FIELD-EXIT file="PRSYSTEM" index="PRSSET1" id="HR-PRS-R-0013" >
<TRIGGERS>
<TRIGGER value="COMPANY-01" />
</TRIGGERS>
<KEY-LIST>
<RULE-KEY value="COMPANY-01" />
<SYMBOLIC-CONSTANT value="SPACES" />
</KEY-LIST>
<RETURN-FIELDS>
<RETURN-FIELD source="NAME" target="HR-COMPANY-NAME" />
</RETURN-FIELDS>
</FIELD-EXIT>
</RULE>
Example of a Detail:
DEFINE SCRDTL "Work Schedule"
ID HR-WSC-D-0001
SCRFLD WORK-SCHED
FILENAME HRWRKSCHD
INDEX WSCSET2
KEYRNG COMPANY-01, WORK-SCHED, WSC-EFFECT-DATE()
<RULE>
<DETAIL file="HRWRKSCHD" index="WSCSET2" id="HR-WSC-D-0001"
title="Work Schedule" >
<TRIGGERS>
<TRIGGER value="WORK-SCHED" />
</TRIGGERS>
<KEY-LIST>
<RULE-KEY value="COMPANY-01" />
<RULE-KEY value="WORK-SCHED" />
<FUNCTION-REF value="WSC-EFFECT-DATE()" />
</KEY-LIST>
</DETAIL>
</RULE>
Example of a Detail with Display Fields:
DEFINE SCRDTL "Absence Plan Structures"
ID HR-TST-D-0001
SCRFLD TA-EMPLOYEE-GROUP
FILENAME TASTRUCTUR
INDEX TSTSET2
KEYRNG COMPANY-01, @CURSCRFLD
DSPFLDS PLAN:"Plan ",PLAN.DESCRIPTION:"Plan Description ",
EMPLOYEE-GROUP:"Structure Group",BEGIN-DATE:"Effective"
<RULE>
<KN-VIEW file="TASTRUCTUR" index="TSTSET2" id="HR-TST-D-0001"
title="Absence Plan Structures" />
<TRIGGERS>
<TRIGGER value="TA-EMPLOYEE-GROUP" />
</TRIGGERS>
<KEY-LIST>
<RULE-KEY value="COMPANY-01" />
<SYMBOLIC-CONSTANT value="CURSCRFLD" />
</KEY-LIST>
<DISPLAY-FIELDS>
<DISPLAY-FIELD name="PLAN" label="Plan " />
<DISPLAY-FIELD name="PLAN.DESCRIPTION" label="Plan Description" />
<DISPLAY-FIELD name="EMPLOYEE-GROUP" label="Structure Group" />
<DISPLAY-FIELD name="BEGIN-DATE" label="Effective" />
</DISPLAY-FIELDS>
</KN-VIEW>
</RULE>
XML drill definitions cannot refer to functions defined in a .sr file. All function references must be to FUNCTION rules defined in the same XML definition file.
Find fields are defined the way display fields are defined. Use FIND-FIELDS and FIND-FIELD as the node names.