|
| 1 | +## json-rule-editor |
| 2 | + |
| 3 | +### Create Decisions |
| 4 | + |
| 5 | +Primarily, we are going to deal with two factors 1) Facts and 2) Decisions across this tool. |
| 6 | + |
| 7 | +***Facts*** |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +***Decisions*** |
| 12 | + |
| 13 | +It is actually business rule conditions which contains the possible facts values and associated outcome type. Here you can define any number of business decision outcomes under single rule. |
| 14 | + |
| 15 | +*Note:* |
| 16 | + |
| 17 | +> Its good practise to separate your business rules into different ruleset files based on the use cases. |
| 18 | +
|
| 19 | +Lets see the step by step process starting from creating facts to generating the ruleset file. |
| 20 | + |
| 21 | +***Step1: Create new ruleset file*** |
| 22 | + |
| 23 | +1. Launch [json rule editor](www.json-rule-editor.com) or install locally via npm |
| 24 | +2. Click **Create button** (Note: Upload functioanlity is explained in next section) |
| 25 | + |
| 26 | +  |
| 27 | + |
| 28 | +***Step2: Specify rule name*** |
| 29 | + |
| 30 | +1. Specify rule name and click **Create button** |
| 31 | + |
| 32 | +  |
| 33 | + |
| 34 | +***Step3: Add new fact*** |
| 35 | + |
| 36 | +1. Click **Create Facts** button at information message panel |
| 37 | + |
| 38 | +  |
| 39 | + |
| 40 | +2. Give fact name and data type such as string, number or array |
| 41 | + |
| 42 | +  |
| 43 | + |
| 44 | +3. Add as many as fact you need to build your decisions |
| 45 | + |
| 46 | +  |
| 47 | + |
| 48 | + |
| 49 | +***Step4: Add new decisions*** |
| 50 | + |
| 51 | +Go to Decisions tab |
| 52 | + |
| 53 | +1. Click **Create Decisions** button at information message panel |
| 54 | + |
| 55 | +  |
| 56 | + |
| 57 | +2. Select all / any in **"Step 1: Add Toplevel"** |
| 58 | + |
| 59 | +  |
| 60 | + |
| 61 | +3. Select Add facts menu in **"Step 2: Add / Remove facts"** |
| 62 | + |
| 63 | +4. Select the fact, operator and value |
| 64 | + |
| 65 | +  |
| 66 | + |
| 67 | +5. Add necessary facts and you will see something as below |
| 68 | + |
| 69 | +  |
| 70 | + |
| 71 | +6. Select the Add Outcome in **"Step 3: Add outcome""** and specify the type value. |
| 72 | + |
| 73 | +  |
| 74 | + |
| 75 | +7. Click **Add Rulecase** button. |
| 76 | + |
| 77 | +  |
| 78 | + |
| 79 | +***Step5: Validate decisions*** |
| 80 | + |
| 81 | +Go to Validate tab |
| 82 | + |
| 83 | +1. Specify the values against facts |
| 84 | +2. Click Validate Ruleset button |
| 85 | + |
| 86 | + |
| 87 | +  |
| 88 | + |
| 89 | +*Note: Please keep in mind when adding facts and value* |
| 90 | +> Incase expected values are not getting displayed, go to Decisions tab and cross check the values. |
| 91 | +> Values are case sensitive and perform strict equality comparison ( === ). |
| 92 | +
|
| 93 | + |
| 94 | +***Step5: Generate rule sheet*** |
| 95 | + |
| 96 | +Go to Generate tab |
| 97 | + |
| 98 | +1. Click generate button if all required decisions are added. |
| 99 | + |
| 100 | +  |
| 101 | + |
| 102 | +*Note:* |
| 103 | + |
| 104 | +> Json rule file will be generated at your default browser download folder. |
| 105 | +
|
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +[Next section - Implementation of Json rules in application](https://vinzdeveloper.github.io/json-rule-editor/docs/implementation.html) |
| 110 | + |
| 111 | +[Go back to previous page](https://vinzdeveloper.github.io/json-rule-editor/docs/rule-engine.html) |
| 112 | + |
| 113 | +[Go Home](https://vinzdeveloper.github.io/json-rule-editor/) |
0 commit comments