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.
#825611
You can create a trigger that fires before the Dynaform that combines the database query and the array contents:
Code: Select all
@=myGrid = array(
   "1" => array(x=>"aa", y=>"bb", z=>"cw"),
   "2" => array(x=>"ab", y=>"bg", z=>"ce"),
   "3" => array(x=>"ac", y=>"bh", z=>"ct")
);
$aRows = executeQuery("SELECT X AS x, Y AS y, Z AS z FROM TABLE_A");
$nextRowNo = count(@=mGrid) + 1;

foreach ($aRows as $aRow) {
     @=myGrid[  $nextRowNo ] = array(
            'x' => $aRow['x'],
            'y' => $aRow['y'],
            'z' => $aRow['z']
     );
    $nextRowNo++;
}
Where "myGrid" is the variable associated with the grid and its fields have the IDs "x", "y" and "z".
#826054
Sriluxshi wrote:Hi
While I am doing this I got one error that is the data is adding by one while refreshing. the nextRowNo value is increasing by one each and every refreshing. How to solve this?
Add a variable that is set the first time the trigger is executed. Then check whether that variable is set before executing the rest of the trigger:
Code: Select all
if (@@alreadyLoaded != 'yes') {
   @@alreadyLoaded = 'yes';
   @=myGrid = array(
      "1" => array(x=>"aa", y=>"bb", z=>"cw"),
      "2" => array(x=>"ab", y=>"bg", z=>"ce"),
      "3" => array(x=>"ac", y=>"bh", z=>"ct")
   );
   $aRows = executeQuery("SELECT X AS x, Y AS y, Z AS z FROM TABLE_A");
   $nextRowNo = count(@=mGrid) + 1;

   foreach ($aRows as $aRow) {
      @=myGrid[  $nextRowNo ] = array(
            'x' => $aRow['x'],
            'y' => $aRow['y'],
            'z' => $aRow['z']
       );
      $nextRowNo++;
   }
}

Web3 development encompasses creating decentralize[…]

The Upland Clone Script, offered by Dappsfirm, rep[…]

Dappsfirm offers a bet365 clone script that mirror[…]

🚀 Tauchen Sie mit Immediate Alora AI in die Welt d[…]