Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

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.
good morning!

I need you help to do the following:

I am working on a process for inventory request, the request can include more than one item to be requested using grid.

some grid columns are quantity approved and item type and item id, based on item approved quantity for each item requested, i need to update an external database for each row and each item with the new stock quantity.

how do I do that ? I have tried a hidden field in grid to update but it is not working, is it trigger the best way ?

You need to use a trigger fired before the Dynaform to populate the grid and another trigger fired after the Dynaform to write the changes in the grid back to the database.

You can use hidden fields to store information in the grid that you don't want the user to see.

Here is an example:
Let's say you have a grid associated with the "inventoryList" variable and this grid has fields with the IDs:
itemId, itemType, quantityApproved

Then, your trigger before the DynaForm with the grid would be:
Code: Select all
$db = '1234567890abcdef1234567890abcdef'; //only needed if using a Database Connection
@=inventoryList = executeQuery($sql, $db); 
Then, your trigger after the Dynaform would be:
Code: Select all
$db = '1234567890abcdef1234567890abcdef'; //only needed if using a Database Connection
if (isset(@=inventoryList)) {
    foreach (@=inventoryList as $aItem) {
         $id = $aItem['itemId'];
         //use addslashes() instead of mysql_real_escape_string() if not a MySQL database:
         $type =  mysql_real_escape_string($aItem['itemType']); 
         $quantity = (int) $aItem['quantityApproved']; //convert from string to integer
         $sql = "UPDATE INVENTORY SET ITEM_TYPE='$type', ITEM_QUANTITY=$quantity WHERE ITEM_ID='$id'";
         executeQuery($sql, $db);

Hi everyone! I am trying to create a link to a ex[…]

Routing Rule

Could you please share a screenshot from your proc[…]


I didn't work on this version of PM but I could su[…]

radio has a data automatic

Make sure you have assigned a variable to the radi[…]