Within the BPM application ProcessMaker, I am trying to copy rows out of one grid within a dynaform to a subsequent grid within a second dynaform. I only want to copy over the rows from the first grid where the checkboxes are checked on. The user does not need to see the unchecked rows.
I tried to have a trigger run BEFORE the subsequent grid and loop through the first grid and check where rows have checkboxes turned On but it doesn’t seem to copy anything.
Below is the code for the trigger. What am I doing wrong?
@=new_grid = array();
$tot = count(@=original_grid);
for ($i = 1; $i <= $tot; $i++) {
if ((@=original_grid[$i]['my_checkbox']) == 'On') {
@=new_grid[$i] = array(
'field1' = @=original_grid[$i]['field1'],
'field2' = @=original_grid[$i]['field2'],
'field3' = @=original_grid[$i]['field3'],
'field4' = @=original_grid[$i]['field4'],
'field5' = @=original_grid[$i]['field5'],
'field6' = @=original_grid[$i]['field6']
);
}
}
this one took a while to figure out. turns out, i had my trigger placed in the wrong location. I needed to place the trigger AFTER derivation/routing. And here is the revised code i ended up using: