The article describes how to use the FOR EACH ROW form rule in practice on the WEBCON BPS 2021 platform. E.g how mark all rows of item list.
What is FOR EACH form rule?
From the version 2021 of WEBCON BPS it is possible to use the form rule named FOR EACH ROW. Previously, to manipulate the values of an item list, for each row of an item list, it was necessary to use loops using JavaScript. Now, simple business logic can be performed using the rules of the form using low code blocks.
Use case: Select / deselect all rows of item list
To achieve the above effect:
- Add a checkbox on the change of which you need to add a form rule as shown in the screenshot below
- That’s it 🙂 Isn’t it fabulously simple?
Use case: Moving only selected lines of the item list
Now a slightly more difficult example, visible in the animation below.
To achieve the above effect:
- Add technical form fields equal to the number of columns in the item list to which you will be moving the rows
- Add a technical checkbox
- Add a button (HTML form field)
- Add a form rule in the technical checkbox added in point 2)
- The FOR EACH ROW rule does not allow the use of the ADD NEW ROW rule relating to other item list than current nesting. Therefore, a named business rule should be used to avoid this problem.
- Set the default values of the columns as in the attached screenshot
- Configure the HTML form field as shown in the attached screenshot
- Don’t forget to show the form fields on the attribute matrix
How it works? When button will be clicked, technical checkbox value will be changed. Then form rule executed on value change of this checkbox will be trigerred. Firstly item list number 2 will be cleared, then for each row of item list number 1: row by row value in column “Check” is verified. Id checkbox is checked the technical form fields are filled with data of current row. Then new row of item list numer 2 is created and values are automatically filled by default values which gets values from technical fields.