C:\DITA\WKFS_oXygen_Files\fragments\webhelp.fragment.head.xml
Jump to main content C:\DITA\WKFS_oXygen_Files\fragments\webhelp.fragment.before.body.xml

# Product Technical Rule (PTR) Reference

In order for Requirements Editor to generate the code for documents, you must format the Product Technical Rules (PTRs) correctly and use the defined Keywords within the tool. PTRs are written for Conditions (inclusion rules), Data Elements, Packages, and Iterators.

## Key Words

IF: An IF would be used in each condition to indicate the criteria for the condition. IF is valid within any PTR (other than the instance iterator) and each IF must have a THEN and an ENDIF. A space is always needed after an IF. IF can use the following operators:

    = (Equal)
    != (Not Equal)
    > (Greater Than)
    < (Less Than)
    >= (Greater Than or Equal)
    <= (Less Than or Equal)

THEN: Each IF has a corresponding THEN to indicate what should happen when the IF criteria is met. A space is always needed before a THEN and a return is used after a THEN.

ENDIF: Each IF has a corresponding ENDIF to indicate where the IF logic terminates. A rule with multiple IF statements would have multiple corresponding ENDIFs.

    IF /LOAN/_CLOSING_DOCUMENTS/LOAN_DETAILS/@DocumentsDrawnInNameType = 'Lender'
    THEN
     PRINT /LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress ", "
     IF string(/LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress2) != "" THEN
     PRINT ", " /LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress2
     ENDIF
    ENDIF

INCLUDE: A condition always ends with INCLUDE. The condition will say IF, THEN, and end with INCLUDE to indicate that if the corresponding condition is met then any content that is a child of that condition would be included.

CHECKBOX: For a Field that is a checkbox (defined in the Output Format), the PTR would end with THEN CHECKBOX.

SELECT: For the Package Rule, the PTR would end with THEN SELECT. See Package Rule section for more information.

PRINT: A data element always includes at least one PRINT statement. Within a data PTR any text to print other than schema paths must be in quotes, including but not limited to spaces and commas. For example:

    PRINT /Txn/OrgCity .” “ /Txn/OrgState “ “ /Txn/OrgPostalCode

The quotes are needed for the comma and space after city as well as the space before postal code.

ELSEIF: For a series of possible criteria within a rule, an IF is used for the first criteria and an ELSEIF is used if there is an alternative to the IF that requires its own criteria. For example:

    IF /Txn/OrgState = 'MN' THEN
     PRINT "Apples"
    ELSEIF /Txn/OrgState = 'OK' THEN
     PRINT "Bananas"
    ENDIF

ELSE: Once a rule has an IF, if there is an alternative rule that should apply any time the IF (as well as any ELSEIFs) does not apply then an ELSE can be used. For Example:

     IF /Txn/OrgState = 'MN' THEN
     PRINT "Apples"
    ELSEIF /Txn/OrgState = 'OK' THEN
     PRINT "Bananas"
    ELSE
     PRINT "Pears"
    ENDIF

In the above rule, “Pears” would print any time the OrgState was not MN or OK.

or: or can be used within a PTR to create alternative rules. Or’s should always be in lower case in the rule. A space is needed before and after the or. For example:

    IF ./OrgResponsibilityType = '1' or string(./SelfDirectedInd) != '1' THEN
     INCLUDE
    ENDIF

In the rule above, the content that is a child of the condition would be included when a transaction met either of the two criteria.

and: and can be used within a PTR to require multiple criteria to be met. And’s should always be in lower case in the rule. A space is needed before and after the and. For example:

    IF ./OrgResponsibilityType = '1' and string(./SelfDirectedInd) != '1' THEN
     INCLUDE
    ENDIF

In the rule above, the content that is a child of the condition would be included when a transaction met both of the two.

[]: Brackets are used for rules nested within an XPath. The most common use of brackets is when the code is looking at a repeatable collection/container and we need to identify which instance of that repeatable item to use. For example, there can be multiple Accounts in a Deposit transaction. If a rule needs to look for an Account that has a Type of Checking (1) the XPath would look like this:

    /Txn/Deposit/Accounts/Account[AccountType = '1']

(): Parenthesis are used to group logic together. Much like in math problems, if there are multiple or’s and and’s ( ) are used to indicate which or’s and and’s go together.

For example, let’s start with a rule with no ( ):

    IF /Txn/OrgState = 'MN' or /Txn/OrgState = 'OK' or /Txn/OrgState = 'AK' and /Txn/OrgCharter = 'Federal' THEN

Without any ( ) the last criteria for OrgCharter will only be evaluated if OrgState is AK. In order to have OrgCharter considered with all of the states ( ) would be needed around the states:

    IF (/Txn/OrgState = 'MN' or /Txn/OrgState = 'OK' or /Txn/OrgState = 'AK') and /Txn/OrgCharter = 'Federal' THEN

Note: Any time there are multiple ORs and ANDs in a rule it is best to use ( ) to group them to avoid confusion.

Quotes: Double Quotes (“ ”) are used around anything to Print within a Data Element other than a schema path. For example, printing a comma or a space in an address:

    IF /LOAN/_CLOSING_DOCUMENTS/LOAN_DETAILS/@DocumentsDrawnInNameType = 'Lender'
    THEN
     PRINT /LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress ", "
     IF string(/LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress2) != "" THEN
     PRINT ", " /LOAN/_CLOSING_DOCUMENTS/LENDER/@_StreetAddress2
     ENDIF
    ENDIF

Single quotes (‘ ‘) are used around specific enumerated values being checked in a rule (‘Lender’ in the rule above).

String: When evaluating Enumeration data points to be = “” (nothing) or != to certain values a String function must be added around the data point. A String function starts with the word "String" and is followed by an XPath in ( ). For example, if rule is entered as `IF /Txn/OrgState != ‘MN’`, Requirements Editor converts it to `IF String(/Txn/OrgState) != ‘MN’`. Rules looking for an Enumeration data point equal to a certain value do not need the string function (for example `IF /Txn/OrgState = ‘MN’` does not need String).

Count: A rule can be written to look at the number of instances of a given data point when the data point is in a repeatable collection/container. In order to do this the Count function is used. A count function always starts with the word “Count” and is followed by the XPath for the data point being counted in ( ). For example:

    IF Count(/Txn/Deposit/IRAPlans/IRAPlan/Fees/Fee[Type=’99’]) > 0 THEN
     INCLUDE
    ENDIF

The above rule would return as True if there was at least one Fee in the transaction with a Type of 99.

C:\DITA\WKFS_oXygen_Files\fragments\webhelp.fragment.after.body.xml