You are here: Reference > Tools, accelerators, and wizards > About the Rule-from-File wizard (Rule harvesting)

About the Rule-from-File wizard (Rule harvesting)

You can create a flow, decision table, decision tree, or map value from a Windows file in an appropriate format, following a guided sequence of steps. The uploaded file becomes a starting definition of the rule. This capability is called rule harvesting. The original file remains attached to the rule as a Custom Field value.

Basics

Resuming the wizard

This wizard creates a work item with the prefix pxAT-. To find open wizard work items, select Designer Studio > Application > Tools > All Wizards.

Starting the wizard

  1. Set the appropriate work pool, by selecting Switch Work Pool >work pool name from the Application menu.
  2. Select Designer Studio> Integration > Tools > Rule from File Wizard.
  3. Complete the forms in the screen flow. For guidance, see Help — Rule-from-File wizard.

Harvesting a .txt file to a decision tree

To harvest a decision tree from a text file, prepare a file in the following format:

The formal syntax in approximate Backus-Naur form is:
[EVALUATE] <propertyname>
IF [NOT] <expression> THEN [CONTINUE | EVALUATE 
<expression> |
   %CALL <treename> | CALL DECISIONTREE <treename >
  !RETURN <expression>
OTHERWISE [RETURN] <expression>

where % indicates a horizontal tab character. Line endings are significant. Extra spaces are ignored. For example:

EVALUATE .BallorStrike
     %IF ((.Height > 4) && .NoSwing && .BatterNotStruck)) THEN 
CONTINUE
     %      %IF (Height > 3) THEN RETURN "Ball"
     %      %IF (Height < 1) THEN RETURN "Ball"
OTHERWISE RETURN "Strike"

where % indicates a horizontal tab character. Another example:

EVALUATE Label
IF General Task THEN EVALUATE Urgency
   %IF > 20 THEN RETURN true
   %OTHERWISE RETURN false
IF NOT General Task THEN CONTINUE
   %If Label = Medical THEN RETURN true
   %OTHERWISE RETURN false
IF somethingelse THEN call somedecision
OTHERWISE RETURN other

When you import the file using this wizard, the system creates a decision tree from the file.

Harvesting a Public flow XML file to a flow

Pega Platform's internal XML representation of a flow rule conforms closely to the XML schema stored in the standard text file rule Harvest.Publicflow.xml. You can use the Rule-from-File wizard to import an XML file conforming to this schema and create a draft flow rule. To work with this schema:

  1. Open the Harvest.Publicflow.xml text file rule
  2. Export the text to a local drive.
  3. Change the file type to "xsd" from "xml".
  4. Validate your XML file against the XSD.
  5. Start the Rule-from-File wizard.

On the Attach File wizard step, select Public Flow as the Format value.

Harvesting a BPEL 1.1 XML file to a flow

When harvesting an XML file in BPEL 1.1 format, the wizard makes the following conversions:

BPEL 1.1 element

Flow shape

flow, sequence, and scope New flow rule
assign Utility
receive AssignmentService
flow, sequence, and scope Call or branch to subflow
invoke and reply Integrator
partnerlink, partner, CorrelationSet N/A
throw Utility to set a ticket
switch Call or branch to subflow
while Call or branch to subflow

Harvesting an Excel worksheet to a map value

To create a map value (Rule-Obj-MapValue rule type) from an Excel worksheet:

  1. Create an Excel worksheet of file type XLS that contains the values that specify the Matrix tab settings in the Map Value rule form:
    1. Leave cell A1 blank.
    2. In cells A2, A3, ..., enter text that is to become the column headers.
    3. In cells B1, C1, ..., enter text that is to become the row headers.
    4. Enter constants in a final row (with the first column blank) for the Default row, and similarly enter a rightmost Default column. (If the condition value is simply a number, then format the column cells as text, not numbers, and type "=" or" ==" before the number. For example, =1000.
  2. Complete all steps of the Rule-from-File wizard. After you upload the XLS file, it becomes a custom field value on the History tab of the rule.
  3. After the Rule-from-File wizard completes, further processing is required. Click the edit icon to open the map value.
  4. Click Edit In Excel. If prompted, adjust macro security to Medium or lower to enable Excel macros.
  5. When initial macro execution ends, click the Convert button (in Excel 2010, click the Add-Ins menu to see the Convert button).
  6. Close Excel and save the Excel file when prompted; this applies the changes to the Map Value rule form .
  7. Update the Input tab of the Map Value rule form as necessary. Optionally, select the Row Property and Column Property properties.
  8. Update the History tab and other tabs as desired.
  9. Save the form.

By default, the rule is saved with Availability = No/Draft Mode. See How to change rule availability.

Tools — Integration