Create your First Project

◷ Reading Time: 19 minutes

Create a New Project

Open FlexRule Designer.

Designer launching window

Sign in using your FlexRule username (not email) and password.

LoginpageV10

Once you log in successfully, it will open the home page.

Designer home

Click on Create a New Project.

Create New project V10

Enter a name and project path to save the project and click OK.

First Project screenV10

The project will then be created as shown below.

Download the help content if you see the notification.

Notifications in V10

Create the Concept

Add documents to the project.

Project Explorer Window  V10

Select Fact Concept and add it.

New Document V10

 

Drag and drop a Fact. Bring up the toolbox with the key command alt + x or in the top ribbon menu navigate to View > Toolbox

Double-click on the fact name and change it to ‘Person’.

Right-click on the fact, and select Edit Members.

Edit Members in Fact V10

Add the member ‘Age’. Its Type should be Integer.

Fact concept type V10

Add another member for ‘State’. But this time, we are not adding any Type.

2 members in Fact V10

Drag and drop an Option.

Double-click and rename it to ‘State’.

Right-click on the ‘State’ option and add members.

Member of Options in Fact V10

Drag the cursor from State() in Person fact, to the State option to connect them.

Add another member ‘IsMember’ and the Type should be boolean.

Validate the concept document.

There should be no errors in the document. If you see any errors, you should fix them before moving on.

Save the concept document.

Create a Decision Table

Add a new file.

Add a decision table and name it ‘Store Discount.xml’.

Create new DT in V10

Double-click on the created decision table to open it.

Click on Variable Parameters to add parameters.

From Assembly, select the concept document we created in the previous section.

Select concept in variable def V10

Select the fact from Type.

Select assembly type

Add a name to the concept.
As you can see below, the Direction of the variable should be In as we will input the person’s data.

Variable Definition V10

Next, add a Local variable called ‘StoreDiscount’. This is what we use to assign the discount in this decision table. Its Type should be decimal.

Second Variable Parameter definition

Select the column and change the Column Name to ‘Age’.

Now click on Expression to add an Expression to the column. If you press Ctrl + Space, you will see the list of defined variables.

Select Person from the list.

When you type . it will show the members of the fact, ‘Person’. Select Age from that list.

Expression Fact suggestions

Now we have added the column name and expression to the first condition.

Properties window with expressionV10

Drag and drop another condition from Toolbox on the right side.

In the same way, we added ‘Age’, add column name, and expression for ‘State’.

State column in DT V10

Drag and drop an Action from Toolbox on the right side.

In the same way we added ‘Age’, add column name, and expression for ‘Store Discount’.

Action Column expression in DT V10

Type the following data to create the first rule.

Click New Row After to add a new row.

Enter the following rules.

[ and ] represent the inclusion. ( and ) represent exclusions. In this example, [50;65) means greater than or equal to 50 and less than 65.

Click on Properties to open document properties.

Select false from Process All Rows to make the decision table a single-hit. Then execution of the decision table stops as soon as a business rule is satisfied.

Process all row V10

Now you will see that the decision table is a SingleHit.

Validate and Debug

First, we will validate it.

If there are any errors, you will see that in the Message List window.

Click on Debug with JSON Composer.

Click Yes to save the document.

Unsaved Items V10

Enter Age and State and click OK. For example, let’s enter 54 as Age and Select NSW from the drop-down list.

json Composer V10

Execution will start and click Step In to go step-by-step.

Debug Step 1 V10

Keep clicking Next Step until you get a rule that gets satisfied. Since we made the decision table SingleHit, the execution completes as soon as a rule is satisfied. You can see the satisfied rule in Green.

Successful run in V10

If you look at the Parameters window, you can see the output StoreDiscount as 0.3

Parameter window V10

Create a Natural Language Document

Click on New.

Add Natural Language document as ‘Extra Discount.xml’.

NL for V10

Double-click and open the Natural Language document.

Click on Variable Parameters.

Add ‘Person’ and ‘ExtraDiscount’ variables.

Variables in Nl

Press Ctrl + Space to view the variables.

Select ‘Person’ and press . to see the list of members in ‘Person’. Select ‘IsMember’ from the list.

Complete the logic by adding the actions. You can always press Ctrl + Space to view the defined variables.

when a logic name
  Person.IsMember 
then
	ExtraDiscount = 0.3
otherwise
	ExtraDiscount = 0.1
end

Validate and Debug

Validate the document.

You can see the validation results.

Click Debug with JSON Composer.

Click Yes, if you haven’t saved the document already.

Unsaved Items V10 NL

Select Yes and click OK.

Json Composer NL V10

Click Next Step until the execution completes.

Next Step in NL Debug V10

You will see the matched business rule highlighted in Green.

NL Debug success in V10

You can see the results in the Parameters window.

Create the Decision Requirement Diagram (DRD)

Click on Add New Document.

Create DRD in V10

Add a DRD. Let’s call it ‘Calculate Discount.xml’.

Calculate Discount DRD

Double-click on the file to open it.

Drag and drop the logic files: Store Discount.xml and Extra Discount.xml.

Drag and drop DT in to DRD V10
Drag and drop DT in to DRD V10 V2

You can resize the node.
To resize the label, press Alt and click on the label.

Drag and drop a Decision node from the toolbox.

Rename the node to ‘Calculate Discount’.

Add an Out variable called ‘Discount’.

Variable definition for DRD in V10

Click on the node ‘Calculate Discount’ and add the following expression to it.

Discount = StoreDiscount + ExtraDiscount
Expression in a Decision Graph V10

Connect the nodes defining the decision hierarchy.
You can see that to calculate the discount, you need both store and extra discount.

Drag and drop an Input Data node.

Change its properties. So, the input will be the Person object defined in the concept file.

Double-click on the input node to rename it.

Connect it to the main decision which is ‘Calculate Discount’.

You can change the colors to make the final decision clear.

Color the Decision Nodes V10

Validate and Debug

Validate the document.

There should be no errors.

Debug the document.

Enter the test values and click OK.

Json Composer DRD V10

Click Next Step at every step.

Click Yes to go into the child model.

Open Linked Model V10

You can see the output which is the calculated ‘Discount’ in the parameters window.

Parameter response in DRD V10

Create a Logic Run Template

You can create a Logic Run Template to store input data. Then, instead of manually entering input values, you can select a template and debug/ run it.

Open the file Calculate Discount.xml.

Click on Start Debugging.

Start debugging V10

Enter the values you want to test.

Json Composer DRD V10

Click Save as Run Template.

Save Run Template V10

Give a title and description.

Save Run Template NSW V10

The Logic Run Template is saved.

Saved Success V10

You can close the Input JSON Composer.

Now if you click on Logic Run Template, you will be able to see the saved template.

Logic Run Template V10

You can debug or run the selected template.

Run Template V10
Updated on June 25, 2025

Article Attachments

Was this article helpful?

Related Articles