CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 How to Display the value of a record from a List, on a Grid.

Print topic Send  topic

Author Message
joejac

Posts: 242
Posted: 09/13/2007, 5:38 AM

Hello,

I have the following values for a security level record on a Grid that do not have a table associated, only these values:

1, Author 2, Editor

I followed the solution of this post:

http://forums.codecharge.com/posts.php?post_id=70374

but It did not show the correct text value, only the caption of the label of the form (privilegios, is in Spanish), can any one help me to find my mistake?.

Following is the code for the full even page, thanks a lot.

---------------------------------------------------------------------------
<?php
//BindEvents Method @1-F71D8313
function BindEvents()
{
global $usuarios;
$usuarios->privilegios->CCSEvents["BeforeShow"] = "usuarios_privilegios_BeforeShow";
}
//End BindEvents Method

//usuarios_privilegios_BeforeShow @25-22DD4B66
function usuarios_privilegios_BeforeShow(& $sender)
{
$usuarios_privilegios_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $usuarios; //Compatibility
//End usuarios_privilegios_BeforeShow

//Custom Code @30-2A29BDB7

// ------------------------- FOLLOWING BeforeShow event CODE

switch ($Component->GetValue()) {
case 1:
$Component->SetValue('Autor');
break;
case 2:
$Component->SetValue('Editor');
break;
case "":
$Component->SetValue('n/a');
break;
}

// -------------------------
//End Custom Code

//Close usuarios_privilegios_BeforeShow @25-AC31C295
return $usuarios_privilegios_BeforeShow;
}
//End Close usuarios_privilegios_BeforeShow


?>
---------------------------------------
View profile  Send private message
wkempees
Posted: 09/13/2007, 10:34 AM

Try this:
  
echo 'value of current field is : ' . $Component->GetValue();  
  
 switch ($Component->GetValue()) {  
 case '1':  
     $Component->SetValue('Autor');  
     break;  
 case '2':  
       $Component->SetValue('Editor');  
      break;  
 default:  
        $Component->SetValue('n/a');  
        break;  
 }  

Because I assume your field being of type text.
If it is not type text than it will not display text.
The line starting wth 'echo' will nicely display the current value of your
variable.
Use it for debugging delete or comment the line out when it works.

(Changes are : single quotes and default)
Walter


joejac

Posts: 242
Posted: 09/13/2007, 1:33 PM

I am very thankful Walter :-)

With the echo I realized I had the Control Source type for the Data Properties of the Label Form in "Code Expression" which was wrong. I changed it to "Database Column", I selected the privilege field and it worked fine.

Thanks a lot Walter
joejac
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.

Web Database

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.