Generate output document from Grid

Discussion about developing the ProcessMaker application and suggestions for improving it

Moderator: amosbatto

ahmadkastero
Posts: 5
Joined: Thu Nov 09, 2017 3:34 am
Country: United States of America

Generate output document from Grid

Unread postby ahmadkastero » Thu Nov 09, 2017 5:01 am

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 293 times

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Generate output document from Grid

Unread postby amosbatto » Fri Nov 10, 2017 12:58 am

See: http://wiki.processmaker.com/3.0/Output_Documents#Grids_in_Output_documents

In the grid field that contains a dropdown, if the field has an ID of "Product", then you should use @#Product_label instead of @#Product to get the displayed label.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

ahmadkastero
Posts: 5
Joined: Thu Nov 09, 2017 3:34 am
Country: United States of America

Re: Generate output document from Grid

Unread postby ahmadkastero » Sat Nov 11, 2017 1:23 pm

Thank you very much but i try and doesn't work it works with drop down list the normal one not that inside grid.
i attached one sample for what i'm working on if you can help please.
Attachments
Test_Output_Doc[Structured_Visit_Report]-1.pmx
(98.33 KiB) Downloaded 5 times

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Generate output document from Grid

Unread postby amosbatto » Tue Nov 14, 2017 12:17 am

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>
<[email protected]>ProductCheck_Grid-->
<tr>
<td>@@dropdown0000000001</td>
<td>@#DropProduct</td>
<td>@%text0000000002</td>
</tr>
<[email protected]<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>
<[email protected]>ProductExpiryCheck_Grid-->
<tr>
<td>@#DropProduct_label</td>
<td>@#datetime0000000001_label</td>
<td>@#text0000000002</td>
</tr>
<[email protected]<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.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

ahmadkastero
Posts: 5
Joined: Thu Nov 09, 2017 3:34 am
Country: United States of America

Re: Generate output document from Grid

Unread postby ahmadkastero » Thu Nov 16, 2017 3:17 am

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>
<[email protected]>ProductCheck_Grid-->
<tr>
<td>@@dropdown0000000001</td>
<td>@#DropProduct</td>
<td>@%text0000000002</td>
</tr>
<[email protected]<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>
<[email protected]>ProductExpiryCheck_Grid-->
<tr>
<td>@#DropProduct_label</td>
<td>@#datetime0000000001_label</td>
<td>@#text0000000002</td>
</tr>
<[email protected]<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'.!

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Generate output document from Grid

Unread postby amosbatto » Thu Nov 16, 2017 6:44 pm

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 211 times

Then use @#variable_label in your Output Document.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

ahmadkastero
Posts: 5
Joined: Thu Nov 09, 2017 3:34 am
Country: United States of America

Re: Generate output document from Grid

Unread postby ahmadkastero » Sun Nov 19, 2017 2:49 am

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?

amosbatto
Posts: 5564
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: Generate output document from Grid

Unread postby amosbatto » Mon Nov 20, 2017 8:36 pm

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.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)


Return to “Development of the ProcessMaker application”

Who is online

Users browsing this forum: No registered users and 1 guest