# Implementing the Child over 3 years old is free promotion step

## Creating the rule

Create a new Guided Rule that you call YougestUnder3yearsOldFree

then Add a new Constraint

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1-aWaHAaIVJlkn%2Faction01.png?generation=1580825261096434\&alt=media)

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc111M68SoYNXsJp%2Faction02.png?generation=1580825260721739\&alt=media)

Select the List class. Click on the "There is a list.." and the click on the Expression Builder button

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc13YXlynpq34uFu%2Faction03.png?generation=1580825260952300\&alt=media)

on the first "Choose" select the size() function and on the second "greater than"

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc15sJ8A1djSCXEP%2Faction04.png?generation=1580825261254511\&alt=media)

Then click on the pencil ![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc17ZCDSKhnQ3fhp%2Faction05.png?generation=1580825260781392\&alt=media) Click on the "From Collect" link and then chose the person fact type

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc19sPK7gSHfTro7%2Faction06.png?generation=1580825260583153\&alt=media)

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1B0eRAbUYttBLH%2Faction07.png?generation=1580825260438289\&alt=media)

Then click on the "All Person with" link and select the age attribute and add the following constraint.

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1Dne0lwggf1MAQ%2Faction08.png?generation=1580825262231715\&alt=media)

Then Add a new constraint of type Accumulate

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1FbAprmS3tzSbD%2Faction09.png?generation=1580825261116675\&alt=media)

And select the Number type from the add a pattern link.

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1HQMKIpWr_TS-P%2Faction11.png?generation=1580825261926331\&alt=media)

Then make the rule look like this

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1JKCxPAZRr6wkB%2Faction13.png?generation=1580825261630987\&alt=media)

## Creating rule to insert a period

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1LphV0MrAaZqyP%2Faction04.png?generation=1580825262139434\&alt=media)

Create a drl file with the following content

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1NYIhzSU5WyD2k%2Faction05.png?generation=1580825261820525\&alt=media)

## Creating rule to start a process

To be able to start a process from a test scenario, we want to insert an object and set a attribute that would be the process id we want to start. So we first create a new Item of type Data Obkect that we shall call StartProcess. And we should add a field called procesId of type String

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1PDbDlF9XcMzpC%2Faction01.png?generation=1580825261781241\&alt=media)

Then we shall create a guided rule called StartProcessRule as follows. In the Then add free form drl ![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1RTj3mve7vQEMv%2Faction03.png?generation=1580825262188554\&alt=media)

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1T-uT85gF0rNsX%2Faction02.png?generation=1580825261419196\&alt=media)

## Testing the rule

Create the test scenario by inserting Objects like follows.

![](https://2162667257-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-FWW6zn6BoLbrPp_j8%2F-M-FWXeF2rB74vmY-cqZ%2F-M-FWc1V2TCeBfBsa_3F%2Faction06.png?generation=1580825262506471\&alt=media)
