Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
User avatar
By groakes
#814218
Hi folks,

I am trying to store the contents of checkgroup int a report table as described in http://wiki.processmaker.com/3.1/Report ... heckgroups

I am using Community 3.2.1

But am coming up with a problem which is probably easily solveable by someone who knows what they are doing (I'm a dwarf standing on the shoulders of giants).

I have a checkgroup field named aPSEDEducationFields. I am trying to write the contents into a column called FIELD in PMT_APSED_EDUCATION_FIELDS. I have a trigger (as per below) which is executed after the Dynaform.

However, when the trigger runs it only creates one row and writes the value of the first item.
Code: Select all
$caseId = @@APPLICATION;
//look up the case number (and case status if needed):
$result = executeQuery("SELECT APP_NUMBER, APP_STATUS FROM APPLICATION WHERE APP_UID='$caseId'");
$caseNo = $result[1]['APP_NUMBER'];

//first delete all existing records from this case, if updating:
executeQuery("DELETE FROM PMT_APSED_EDUCATION_FIELDS WHERE APP_UID='$caseId' ");

//then insert a new record for each row in the "aPSEDEducationFields" checkgroup
for ($rowNo = 0; $rowNo < count(@=aPSEDEducationFields); $rowNo++) {
   $field = @=aPSEDEducationFields[$rowNo];
   $query = "INSERT INTO PMT_APSED_EDUCATION_FIELDS (APP_UID, APP_NUMBER, ROW_NO, FIELD)
      VALUES ('$caseId', '$caseNo', '$rowNo', '$field')";
   executeQuery($query);
}
All assistance is greatly appreciated.

cheers
Greg
By AlanBueno
#814234
Hello greg, please notice that in the example from that link, they are de-encoding and encoding the checkgroup using json, this is because if you dont do that the array variable that holds the values selected only has the checked options, for example, lets say you have a checkgroup with 3 options: 1, 2, and 3; if the user checks options 1 and 3 the array holding the values will be ["true", "true"], it will not be ["true", "false", "true"] .
User avatar
By amosbatto
#814237
I suspect that your Report Table is eliminating the other rows, because Report Tables are designed to only have one row in the table per case.
You should create a separate PM Table and write to that table.
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]