Page 1 of 1

Pulling data from grid

Posted: Wed Jun 07, 2017 12:47 pm
by Throwaway
I am attempting to pull the entered information from a grid. Assuming this is the grid and you cannot add/remove rows. How would I pull this specific data http://imgur.com/CMg1SZJ

Basically how would I pull the date from the grid variable?

$pdf->Write(0, $variables->Grid1['Lastname']);

Re: Pulling data from grid

Posted: Wed Jun 07, 2017 9:19 pm
by amosbatto
In a trigger, you can use this code, if your grid variable is "mygrid" and the IDs of the grid fields are "firstName", "lastName" and "middleName":
Code: Select all
if (isset(@=mygrid) and count(@=mygrid) >= 2) {
  //data from the first row, stored in local variables
  $first1 = @=mygrid[1]['firstName'];
  $middle1 = @=mygrid[1]['middleName'];
  $last1 = @=mygrid[1]['lastName'];
  //data from the second row, stored in case variables
  @@first2 = @=mygrid[2]['firstName'];
  @@middle2 = @=mygrid[2]['middleName'];
  @@last2 = @=mygrid[2]['lastName'];
}
Set the above trigger to fire at some point after the DynaForm.

Then you can use @@first2, @@middle2 and @@last2 in a subsequent trigger or #first2, @#middle2 and @#last2 in your Output Document or email template.

Re: Pulling data from grid

Posted: Thu Jun 08, 2017 9:23 am
by Throwaway
amosbatto wrote:In a trigger, you can use this code, if your grid variable is "mygrid" and the IDs of the grid fields are "firstName", "lastName" and "middleName":
Code: Select all
if (isset(@=mygrid) and count(@=mygrid) >= 2) {
  //data from the first row, stored in local variables
  $first1 = @=mygrid[1]['firstName'];
  $middle1 = @=mygrid[1]['middleName'];
  $last1 = @=mygrid[1]['lastName'];
  //data from the second row, stored in case variables
  @@first2 = @=mygrid[2]['firstName'];
  @@middle2 = @=mygrid[2]['middleName'];
  @@last2 = @=mygrid[2]['lastName'];
}
Set the above trigger to fire at some point after the DynaForm.

Then you can use @@first2, @@middle2 and @@last2 in a subsequent trigger or #first2, @#middle2 and @#last2 in your Output Document or email template.
Would there be another way if I am already pulling them via REST? The PHP I am adding for this is from a library outside of ProcessMaker.

Re: Pulling data from grid

Posted: Thu Jun 08, 2017 5:41 pm
by amosbatto
See: http://wiki.processmaker.com/3.0/REST_A ... Fvariables
See the PHP example for how to access a grid.