Ton
Posts: 12
|
| Posted: 03/06/2008, 2:23 PM |
|
I have a grid which should show the count of errors selected and counted from an other table. I run the code below in a before show event in the grid but the label Label1 in the grid organisationroom always shows "0"
To track down the problem I echo the value $messagecounter and this echos the right value.
Where should I run this custom code to make shure the value is shown in the grid?
$db = new clsDBbeamerbase();
$helper = $organisationroom->Hidden1->Value;
// Get all the entries
$sql = "SELECT ClientErrorError FROM ClientError WHERE ClientErrorAccept = '0' AND ClientErrorRoomid = '$helper'";
echo $sql;
$db->query($sql);
$recordSet=$db->next_record();
$messageCounter = 0;
while($recordSet) // count how many alerts the room has
{
$messageCounter =$messageCounter+1;
$recordSet=$db->next_record();
}
echo $messageCounter;
// Check to see if they have one or more messages and choose which message to display
$organisationroom->Label1->Value = $messageCounter;
_________________
_____________________________________
Origin: NL, CSS4 / PHP / MySQL |
 |
 |
aondecker
Posts: 58
|
| Posted: 03/07/2008, 4:24 AM |
|
Quote Ton:
I have a grid which should show the count of errors selected and counted from an other table. I run the code below in a before show event in the grid but the label Label1 in the grid organisationroom always shows "0"
To track down the problem I echo the value $messagecounter and this echos the right value.
Where should I run this custom code to make shure the value is shown in the grid?
$db = new clsDBbeamerbase();
$helper = $organisationroom->Hidden1->Value;
// Get all the entries
$sql = "SELECT ClientErrorError FROM ClientError WHERE ClientErrorAccept = '0' AND ClientErrorRoomid = '$helper'";
echo $sql;
$db->query($sql);
$recordSet=$db->next_record();
$messageCounter = 0;
while($recordSet) // count how many alerts the room has
{
$messageCounter =$messageCounter+1;
$recordSet=$db->next_record();
}
echo $messageCounter;
// Check to see if they have one or more messages and choose which message to display
$organisationroom->Label1->Value = $messageCounter;
for grids, the code should be in the Before-Show-Row event. I bet if you put it in that, it will work the way you want it to
|
 |
 |
Ton
Posts: 12
|
| Posted: 03/07/2008, 7:58 AM |
|
Sorry, the code was already in that position. If I set the value for the $messagecounter like $messagecounter=1 just before the $organisationroom->Label1->Value = $messageCounter; thing the values show up like 1 on each row.
any idea?
_________________
_____________________________________
Origin: NL, CSS4 / PHP / MySQL |
 |
 |
Ton
Posts: 12
|
| Posted: 03/07/2008, 12:52 PM |
|
found the solution. The variable $messageCount should be a global variable and in the properties of the Label1 label in the field control source the variable $messageCount should be filled in.
Ton
_________________
_____________________________________
Origin: NL, CSS4 / PHP / MySQL |
 |
 |
|