json-rule-editor
Create Decisions
Primarily, we are going to deal with two factors 1) Facts and 2) Decisions across this tool.
Facts
Its an entity or attribute helps to build your business decisions. It supports four data types such as number, string, array and object - inline with json rules engine.
Decisions
It is actually business rule conditions which contains the possible facts values and associated outcome type. You can define any number of business decision outcomes under single rule file.
Note:
Its good practise to separate your business rules into different files based on the use cases.
Lets see the step by step process starting from creating facts to generating the ruleset file.
Step1: Create new ruleset file
- Launch json rule editor or install locally via git clone
-
Click Create button (Note: Upload functioanlity is explained in next section)
Step2: Specify rule name
-
Specify rule name and click Create button
Step3: Add new fact
-
Click Create Facts button at information message panel
-
Give fact name and data type such as string, number or array
-
Add as many as fact you need to build your decisions
Step4: Add new decisions
Go to Decisions tab
-
Click Create Decision button at information message panel
-
Select all / any in “Step 1: Add Toplevel”
-
Select Add facts menu in “Step 2: Add / Remove facts”
-
Select the fact, operator and value
-
Add necessary facts and you will see something as below
-
Select the Add Outcome in “Step 3: Add outcome”“ and specify the type value.
-
Click Add Rulecase button.
Step5: Validate decisions
Go to Validate tab
- Specify the values against facts
-
Click Validate Ruleset button
Note: Please keep in mind when adding facts and value
Incase expected values are not getting displayed, go to Decisions tab and cross check the values. Values are case sensitive and perform strict equality comparison ( === ).
Step5: Generate rule sheet
Go to Generate tab
-
Click generate button if all required decisions are added.
Note:
Json rule file will be generated at your default browser download folder.