CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 label not updating as expected

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.