Discussion about developing the ProcessMaker application and suggestions for improving it
By ahmadkastero
#796088
Dears, Good day.
I'm New in ProceessMaker and i build a new process and a part of that process there is a grid and i need to generate the values from that grid.
the grid contain drop down list and date and text.

how can i post values in output document regardless on how many records i have ;to be "Dynamic "/.

please help me on this.
Attachments
Grid.JPG
Sample
Grid.JPG (21.3 KiB) Viewed 16529 times
User avatar
By amosbatto
#796133
In your HTML code for your grid in the Output Document, change this code from:
Code: Select all
<table cellspacing="0" border="1">
<tbody>
<tr><th>Product</th><th>First Expiry Date</th><th>Comments</th></tr>
<!--@>ProductCheck_Grid-->
<tr>
<td>@@dropdown0000000001</td>
<td>@#DropProduct</td>
<td>@%text0000000002</td>
</tr>
<!--@<ProductCheck_Grid--></tbody>
</table>
To:
Code: Select all
<table cellspacing="0" border="1">
<tbody>
<tr><th>Product</th><th>First Expiry Date</th><th>Comments</th></tr>
<!--@>ProductExpiryCheck_Grid-->
<tr>
<td>@#DropProduct_label</td>
<td>@#datetime0000000001_label</td>
<td>@#text0000000002</td>
</tr>
<!--@<ProductExpiryCheck_Grid--></tbody>
</table>
Your problems:
1. You were using the wrong grid variable.
2. You should use @#variable, not @%variable.
3. For dropdowns and datetimes you should use @#variable_label
4. You misspelled some of the IDs of the fields in the grid.
By ahmadkastero
#796173
amosbatto wrote:In your HTML code for your grid in the Output Document, change this code from:
Code: Select all
<table cellspacing="0" border="1">
<tbody>
<tr><th>Product</th><th>First Expiry Date</th><th>Comments</th></tr>
<!--@>ProductCheck_Grid-->
<tr>
<td>@@dropdown0000000001</td>
<td>@#DropProduct</td>
<td>@%text0000000002</td>
</tr>
<!--@<ProductCheck_Grid--></tbody>
</table>
To:
Code: Select all
<table cellspacing="0" border="1">
<tbody>
<tr><th>Product</th><th>First Expiry Date</th><th>Comments</th></tr>
<!--@>ProductExpiryCheck_Grid-->
<tr>
<td>@#DropProduct_label</td>
<td>@#datetime0000000001_label</td>
<td>@#text0000000002</td>
</tr>
<!--@<ProductExpiryCheck_Grid--></tbody>
</table>
Your problems:
1. You were using the wrong grid variable.
2. You should use @#variable, not @%variable.
3. For dropdowns and datetimes you should use @#variable_label
4. You misspelled some of the IDs of the fields in the grid.


Thank you very much it works, may i ask one more thing!
How can i get the check box value in out put document if it checked to appear'Yes' if not 'No'.!
User avatar
By amosbatto
#796182
ahmadkastero wrote:
amosbatto wrote:Thank you very much it works, may i ask one more thing!
How can i get the check box value in out put document if it checked to appear'Yes' if not 'No'.!
In the properties of the checkbox in Dynaform Editor, you need to set the list of "options" to have labels of "Yes" and "No":
CheckBoxOptionsList.png
CheckBoxOptionsList.png (38.9 KiB) Viewed 16447 times
Then use @#variable_label in your Output Document.
User avatar
By amosbatto
#798786
ahmadkastero wrote:Thank you very much but this is if it was normal check box i can define the values but in a Grid there is no value i can define it! in this case how can i apply that?
Create a trigger like this in your process:
Code: Select all
if (isset(@=myGrid) and is_array(@=myGrid)) {
   $len = count(@=myGrid);
   for ($i = 1; $i <= $len; $i++) {
      if (@=myGrid[$i]['myCheckbox'] == '1') {
         @=myGrid[$i]['myCheckbox_label'] = 'Yes';
      }
      else {
         @=myGrid[$i]['myCheckbox_label'] = 'No';
      }
   }
} 
Where the grid variable is "myGrid" and the ID of the checkbox field in the grid is "myCheckbox". Set this trigger to fire after the DynaForm containing the grid.

Then, you can use @>myGrid @#myCheckbox_label @<myGrid in your Output Document.
By mjeanbaptiste
#813289
Hi amos i'm working on something similar.
Using that trigger can i tell it not to show the whole row of the grid in the ouput document if it is "NO"? If yes can you please tell me what code to use? Thank you in advance.
User avatar
By amosbatto
#813301
mjeanbaptiste wrote:Hi amos i'm working on something similar.
Using that trigger can i tell it not to show the whole row of the grid in the ouput document if it is "NO"? If yes can you please tell me what code to use? Thank you in advance.
You should create a copy of the grid variable which doesn't include the rows which have the checkbox set to "NO".

Create the following trigger and set it to execute after the Dynaform containing the grid:
Code: Select all
if (isset(@=myGrid) and is_array(@=myGrid)) {
   @=myGridCopy = array();
   $len = count(@=myGrid);
   $i = 1; //counter in original grid
   $iCopy = 1; //counter in filtered grid copy
   for (; $i <= $len; $i++) {
      if (@=myGrid[$i]['myCheckbox'] == '1') {
         @=myGrid[$i]['myCheckbox_label'] = 'Yes';
         @=myGridCopy[$iCopy] = @=myGrid[$i];
         $iCopy++;
      }
   }
}

where "myGrid" is the variable associated with the grid and the checkbox inside the grid has the ID "myCheckbox".

Then you can use this HTML code your Output Document template:
Code: Select all
<table cellspacing="0" border="1">
<tbody>
<tr><th>Field 1</th><th>My Checkbox</th></tr>
<!--@>myGridCopy-->
<tr>
<td>@#myField1_label</td>
<td>@#myCheckbox_label</td>
</tr>
<!--@<myGridCopy-->
</tbody>
</table>
#813364
amos I Have been going at this and my ouput comes out blank here is my trigger
Code: Select all
if (isset(@=listesite) and is_array(@=listesite)) {
   @=listesiteCopy = array();
   $len = count(@=listesite);
   $i = 1; 
   $iCopy = 1; 
   for (; $i <= $len; $i++) {
      if (@=listesite[$i][valid] == 1) {
         @=listesite[$i][valid_label] = Oui;
         @=listesiteCopy[$iCopy] = @=listesite[$i];
         $iCopy++;
      }
   }
} 
#813365
Here's my output

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body>
<p align="center"><font size="4"><b>Liste des sites valid&eacute;s @#datedemande<br /></b></font></p>
<hr />
<p align="center"></p>
<table cellspacing="0" border="1">
<tbody>
<tr><th align="center">Contact</th><th align="center">T&eacute;l&eacute;phone</th><th align="center">Nom du&nbsp; Site</th><th align="center">GPS</th><th align="center">Profondeur</th><th align="center">Valid&eacute;?</th><th align="center">Commentaires</th></tr>
<!--@>listesiteCopy-->
<tr>
<td>@#contact_label</td>
<td align="center">@#tel_label</td>
<td align="center">@#nomsite_label</td>
<td align="center">@#gps_label</td>
<td align="center">@#profondeur_label</td>
<td align="center">@#valid_label</td>
<td align="center">@#commentaire_label</td>
</tr>
<!--@<listesiteCopy--></tbody>
</table>
<p></p>
<p></p>
<p><font size="4"><b>Commentaires:</b></font></p>
<p>@#comments</p>
<p></p>
<p></p>
<p></p>
<p></p>
</body>
</html>

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]