Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#814777
Is it possible to set up a task where users input multiple tasks that will individually need to be ticked off at a later point?

Sort of like a manual input table, then PM pulls each field out as a new variable to be checked against later on?

The items in the checklist would change every time they run the process

Thanks
#814778
You can create a variable of any name in a trigger, but if you need to use that variable either as a value of a field in a Dynaform or in a condition in a gateway, then the variable will need to have a fixed name, so you are going to have to give them names like checkItem1, checkItem2, checkItem3, etc.

Do you want to use these variables in the conditions in your gateways?
Are there a variable number of items to check (e.g., there are three items the first case, 5 items the second case, 2 items the third, etc.) ?

Here is a possible solution if you have a variable number of items to check:
Create a Dynaform with a grid that has a text box in it to enter each item.

Let's say that the variable for the grid is named "itemsToCheckGrid" and the ID of the text box is "item".

Then, create the following trigger to place each of the items in a variable named "itemsToCheckArray" which will populate the list of options in a subsequent checkgroup:
Code: Select all
@=itemsToCheckArray = array();

if (!empty(@=itemsToCheckGrid)) {
   foreach (@=itemsToCheckGrid as $aItem) {
        @=itemsToCheckArray[] = array ($aItem['item'], $aItem['item']);
   }
} 

Then, in a subsequent Dynaform, create a checkgroup whose variable is "itemsToCheckGroup" and whose datasource is "array variable" and the array variable is: @@itemsToCheckArray

Then, the user will be able to mark the items that have been completed in the checkgroup.

If you need to check if all the items are checked in the checkgroup, you can use this code in a condition in a gateway:
isset(@=itemsToCheckGrid) and isset(@=itemsToCheckGroup) and count(@=itemsToCheckGrid) == count(@=itemsToCheckGroup)

To check if some of the items are not checked, then use this condition:
!isset(@=itemsToCheckGrid) or !isset(@=itemsToCheckGroup) or count(@=itemsToCheckGrid) > count(@=itemsToCheckGroup)

Note: if you are sure that the user will never skip the forms, then you don't need the isset() functions.

If you need to check whether the first item is marked, then use this condition:
count(@=itemsToCheckGrid) >= 1 and in_array(@=itemsToCheckGrid[1]['item'], @=itemsToCheckGroup)

If you need to check whether the second item is marked, then use this condition:
count(@=itemsToCheckGrid) >= 2 and in_array(@=itemsToCheckGrid[2]['item'], @=itemsToCheckGroup)

I have created a programming example for this process that you can study:
https://sourceforge.net/p/pmcommunity/c ... stomItems/
#814802
ETanON wrote: I created the trigger from the Process Objects menu - but where exactly do I put it? in the same task that they fill in the grid, under Routing (before routing)?

And what type of variable is itemsToCheckGroup? just as string?
The first question is answered in the text I gave you:
"Set this trigger to fire before the above DynaForm with the checkgroup."

itemsToCheckGroup is an array variable associated with the checkgroup in the second DynaForm. You should download and import the sample process file (Variable_check_list-1.pmx).
#814826
Great thank you Amos!

Now, would it be possible to have the following added functionality?

1 - A user can upload a document and assign it to a particular item entered in at the grid
2 - The checkgroup at the end displays the document that was uploaded aligned to it and allows users to open said document to double check
#814831
ETanON wrote:1 - A user can upload a document and assign it to a particular item entered in at the grid
2 - The checkgroup at the end displays the document that was uploaded aligned to it and allows users to open said document to double check
In Form1, create a grid with a text field and File or MultipleFile field. Then create Form2 to redisplay the same grid, but add a checkbox. Make sure to use the same variable for both grids in Form 1 and Form 2 and the same IDs of the fields inside the grids. Make all the fields Required if you want to guarantee that the user has filled them.
#814842
Thanks Amos - would this replace the previous way of having an array at a later point for the gateway? And if so, what would replace the code at the gateway?

Is there a way to input the uploaded associated file into the array box in the checklist that comes later? To confirm, looking for a way for users to input documents assigned to non-standard variables, and then to be approved by a user at a later point.

And additionally, i'm slightly confused with "File" vs "Fileupload". Why does FileUpload require an Input Document associated with it, but not File?

When I try and combine the grid with a form I also have the attached issue - i am able to add rows but not able to actually type in them?

And finally - is it possible to create a dropdown list of names that I can choose at each step (who've approved) - taking the names from a central database across all steps/tasks? So not just added manually as options for the dropdown properties.
Attachments
Input checklist docs.jpg
Input checklist docs.jpg (26.33 KiB) Viewed 5887 times
#814856
ETanON wrote:Thanks Amos - would this replace the previous way of having an array at a later point for the gateway? And if so, what would replace the code at the gateway?
Yes, it replaces the previous way. There is no need for gateway conditions if you make all the checkboxes required, so you know that they were all marked.
ETanON wrote:Is there a way to input the uploaded associated file into the array box in the checklist that comes later? To confirm, looking for a way for users to input documents assigned to non-standard variables, and then to be approved by a user at a later point.
You can save variables with changeable names to the case with PMFSendVariables(), but creating variables with changeable names is useless because you can't use them in gateway conditions and you can't export them in Report Tables and you can't use them as the variables for Dynaform fields.

The programming to create a checkgroup with links to download each file is tricky, and frankly I don't want to try and explain it. Redisplaying a grid with a MultipleFile field and checkbox in each row is much easier and doesn't require programming. If you really want to do it, then read the documentation on Files and Input Documents to learn how to query the APP_DOCUMENT table in the database.
ETanON wrote:And additionally, i'm slightly confused with "File" vs "Fileupload". Why does FileUpload require an Input Document associated with it, but not File?
MultipleFile (also known as FileUpload in the interface) allows multiple files and works when redisplaying files in grids, so it is recommended instead of File fields inside grids. The developers decided that the files in a MultipleFile field don't need to be associated with an Input Document, but if you want to associate them, then you can use PMFAssociateUploadedFilesWithInputFile() in a trigger.
When I try and combine the grid with a form I also have the attached issue - i am able to add rows but not able to actually type in them?
This could be caused by many things:
1. You didn't define any fields inside the grid
2. You need to set the "column width" property of the grid fields.
3. You need to change the "display mode" property of the grid and its fields to "edit".
4. If you are redisplaying a grid in a second DynaForm, you need to use the same IDs in both the first grid in form 1 and the second grid in form 2.
And finally - is it possible to create a dropdown list of names that I can choose at each step (who've approved) - taking the names from a central database across all steps/tasks? So not just added manually as options for the dropdown properties.

I'm not sure what you mean by "that I can choose at each step (who've approved)", but you can use an SQL query to populate the dropdown. If you want to combine information from a database table and information from your case, then you need to create a trigger and query the database with executeQuery() and then create an array variable which can be used as the datasource of the dropdown. If you aren't a programmer, then you need to hire one to help you.
#814873
HI Amos

one last quick question and i think you'll hear the end from me!

So here's what i'm ultimately looking to achieve. Docs are uploaded to particular lines on a checkgrid (and the size varies), and then it goes to 3/4 separate team to approve - all of whom have to approve in order to proceed to next step.

Is this still feasible using the new method where I just display the same checkgroup etc and make it so that every tickbox has to be checked off?

And what is the potential way to get it so that those who load the deal docs can specify which teams can approve particular boxes.

I.e. they create a checklist with 10 lines and a doc for each line. They assign 3 to Compliance, 3 to credit and 5 to Treasury?

thank you
Ed
Attachments
parallel gateway checklist.jpg
parallel gateway checklist.jpg (33.46 KiB) Viewed 5328 times
#814881
Let's say that your grid is associated with the variable "docsToApprove" and it contains the following fields:
1. MultipleFile with the ID "files", which is Required
2. Dropdown with the ID "approver", which is Required and has the options "Compliance", "Credit" and "Treasury"

Create this trigger to split the "docsToApprove" grid into three separate grids named "docsToApproveCompliance", "docsToApproveCredit" and "docsToApproveTreasury":
Code: Select all
@=docsToApproveCompliance = array();
@=docsToApproveCredit = array();
@=docsToApproveTreasury = array();

if (!empty(@=docsToApprove)) {
   foreach (@=docsToApprove as $aRow) {
      if ($aRow['approver'] == 'Compliance') {
         $nextRowNo = count(@=docsToApproveCompliance) + 1;
         @=docsToApproveCompliance[ $nextRowNo ] = $aRow;
      }
      elseif ($aRow['approver'] == 'Credit') {
         $nextRowNo = count(@=docsToApproveCredit) + 1;
         @=docsToApproveCredit[ $nextRowNo ] = $aRow;
      }
      elseif ($aRow['approver'] == 'Treasury') {
         $nextRowNo = count(@=docsToApproveTreasury) + 1;
         @=docsToApproveTreasury[ $nextRowNo ] = $aRow;
      }
      else {
          throw new Exception("Error no Approver selected");
      }
   }
}
Set this trigger to execute before assignment in your "Load deal documents..." task.

Then place the "docsToApproveCompliance", "docsToApproveCredit" and "docsToApproveTreasury" grids in forms in your parallel tasks.
In each of these grids, you will have the following fields:
1. MultipleFile with the ID "files", which is Required
2. Dropdown with the ID "approver", whose display mode is set to "view".
3. Textarea with the ID "comments"
4. Checkbox with the ID "approved", which is Required

Then, create another trigger which will unify the "docsToApproveCompliance", "docsToApproveCredit" and "docsToApproveTreasury" grids in to one grid whose variable is "docsToApprovedUnified":
Code: Select all
@=docsToApprovedUnified = array();
$rowCount = 0;

foreach (@=docsToApproveCompliance as $aRow) {
   $rowCount++;
   @=docsToApprovedUnified[ $rowCount ] = $aRow;
}
foreach (@=docsToApproveCredit as $aRow) {
   $rowCount++;
   @=docsToApproveUnified[ $rowCount ] = $aRow;
}
foreach (@=docsToApproveTreasury as $aRow) {
   $rowCount++;
   @=docsToApproveUnified[ $rowCount ] = $aRow;
}
After the parallel tasks and the converging gateway, add a script task and set this script task to fire the above trigger.

If you want the reviewers to have the ability to not approve the document, then don't make the "approved" checkbox required, then add the following code to the end of the above trigger that checks whether any of the documents weren't approved.
Code: Select all
@=docsNotApproved = array();
foreach (@=docsToApprovedUnified as $aRow) {
    //if document is not approved, then add the filename and approver to the @=docsNotApproved array:
    if ($aRow['approved'] == '0') {
       @=docsNotApproved[] = $aRow['document'][0]['name'] .' ('.  $aRow['approver'];
    }
}
Then add an exclusive gateway after the script task with the following conditions in the gateway:
Route back to "Load Deal Documents..." task: count(@=docsNotApproved) != 0
Route on to the next task in process: count(@=docsNotApproved) == 0

Then create a Dynaform which contains the "docsToApprovedUnified" grid. Set this Dynaform as the second step in the "Load Deal Documents..." task and add the following condition to the step:
!empty(@=docsNotApproved)

Then, in the same task, add the following condition to the first Dynaform which holds the "docsToApproved" grid:
empty(@=docsNotApproved)
#814897
Hi Amos thanks for that. Unfortunately I'm having issues getting it to run properly - is there any chance you could create an example process file for me and provide the exported form? I can get the form to be sent out to the three separate areas (though the uploaded files don't pull through to all branches?), but then it evaluates out to false and cannot progress after all 3 have been approved?

How do I also add a textbox to the grids that can not only provide a title for each item, but also a brief description (much like the comments box later)

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[…]