Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#822516
All, I understand that this could be a dummy question but I could not find answers from the documentation nor forum, maybe I am searching the wrong keywords...

I have a PM Table "Customer" created with autogen customer ID and other demographics as attributes (e.g. name, address, etc.)

On a process:

Step 1 To display selected fields of the Customer table and have user to select one of customer
Step 2 For selected customer, show a form with all customer attributes for editing and save the edits back to PMTable

Can you shed some lights on how it can be done? I am stuck on the first step to even display the records on a form.

Many thanks.
#822563
Thanks. I have created a trigger with code below which the name of the grid on the Dynaform is customerGrid

$sql = "SELECT CUSTOMERID, CUSTOMERNAME FROM PMT_CUSTOMER";
@=customerGrid = executeQuery($sql);


The customer table contains other attributes besides ID and name.

To complete the mission, I would like to allow the user to select one customer record on the grid and proceed the next form, which display all customer attributes for editing.

Any suggestion on how that can be done?

Thanks a lot!
#822565
Here is an example showing how to edit grid rows in subforms:
https://www.pmusers.com/index.php/Edit_ ... n_subforms

You will need a trigger before the form containing a grid to populate the grid (which you already have).
Then you will need another trigger afterwards to write the changes to the PM Table like this:
Code: Select all
foreach (@=chemicalList as $aRow) {
    $id = (int) $aRow['id']; //assuming that the ID field is an integer
    $name  = mysql_real_escape_string($aRow['name']);
    $desc  = mysql_real_escape_string($aRow['description']);
    $price  = (float) $aRow['price'];

    if (empty($aRow['id'])) {
        //assuming that the ID field is an auto increment field, that will automatically be inserted in the PM Table.
        $sql = "INSERT INTO PMT_CHEMICALS (NAME, DESCRIPTION, PRICE) VALUES ('$name', '$desc', $price)";
    }
    else {
        $sql = "UPDATE PMT_CHEMICALS SET NAME='$name', DESCRIPTION='$desc', PRICE=$price WHERE ID=$id";  
    }
   @@returnVal = executeQuery($sql);
}
Note: if you are using PHP 7, then use mysqli_real_escape_string().
#824916
HeshanKaru1994 wrote:Can you print a grid which is scrollable
If you set the "layout" property of the grid to "static", then you can horizontally scroll to see wider grid rows.

There is no vertical scroll. You can set the "page size" property to limit the size of the grid.

The other option is to use an external library such as ParamQuery to display your grid in a Panel, but that requires making an array with the grid's contents, then using json_encode() to convert it to a string that can be set to a variable which is associated with a hidden field in the Dynaform. Then add JavaScript which uses JSON.parse( ) to convert the hidden field's string into an array which will display the grids contents.

When the Dynaform is submitted, convert the contents of the grid back to a JSON string to save in the hidden field.
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[…]