Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality

Moderator: ArturoRobles

Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
#14775
Thank you Amosbattos. The error message is gone however I have noticed one other problem. I tried to post a reply twice but it never showed up which is why I am starting this as a new topic. One of my query pulls dates and I am trying to assign it to a php array using the method below:

@@sql2 = "SELECT startdate FROM rent";
$result = executeQuery(@@sql2, "2892121264e5f8a6999d3d0092234115");


if (is_array($result))
{
$rent = array():
foreach ($result as $row)
$rent = $row['name'];
}


However the array is treating each number in the date field as a seperate value instead of treating each date as a whole value:

E.g. I am getting

$arr[0] = 2;
$arr[1] = 0;
$arr[2] = 1;
$arr[3] = 1;
$arr[4] = -;
$arr[5] = 0;
$arr[6] = 9;
etc.

instead of getting the result:

$arr[1] = '2011-09-18';
$arr[2] = '2011-10-07';

Any advice on how to get this result?
#14776
Two problems. You need to use square brackets to append new records to the existing $rent array. Also, you are not referencing a field returned by your query. You need to use:
Code: Select all
$rent[] = $row['startdate'];
The complete code should be:
Code: Select all
@@sql2 = "SELECT startdate FROM rent";
$result = executeQuery(@@sql2, "2892121264e5f8a6999d3d0092234115");
if (is_array($result)) {
   $rent = array():
   foreach ($result as $row)
      $rent[] = $row['startdate'];
}
If you still can't figure it out, it helps to assign $result to a case variable so you can examine what is returned in the trigger debugger.

PS: to prevent spam, the first two posts on the forum have to be approved. After this, you should be able to respond to posts without any problems.
#829357
I would, first of all, save yourself a nested query by doing the first query as:
Code: Select all
$result = mysql_query("select Date, min(Speed) as Min_spd, max (Speed) as Max_spd, avg(Speed) as Avg_spd from ... group by Date") https://techzoan.com
And then create a running total for the sums as you're looping through each row:

$sumMinSpeeds=0;
$sumMaxSpeeds=0;
$sumAvgSpeeds=0;
while($row = mysql_fetch_array($result))
{
    echo row['Min_spd'];
    echo row['Max_spd'];
    echo row['Avg_spd'];

    $sumMinSpeeds += $row['Min_spd'];
    $sumMinSpeeds += $row['Max_spd'];
    $sumMinSpeeds += $row['Avg_spd'];

}
echo $sumMinSpeeds;
echo $sumMaxSpeeds;
echo $sumAvgSpeeds;

Hi, I tested with the latest version of the commun[…]

Can anyone solve my problem please? :roll: :roll:

hi. i have two grid and that is fix in 31 rows i […]

:D :D tanks a lot, it is working