CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Create a Variable when Search is used.

Print topic Send  topic

Author Message
manuel

Posts: 48
Posted: 04/19/2013, 5:24 PM

Hi,

I need to hide a Panel based on a Search result

I've already done it on the record form, using DLookup & CCGetParam to create a Variable, and use it to find a record in the DDBB, if this record exists, then show the Form (Visible = Yes) using Hide-Show Component. All this in the Before Show Event.

This same approach doesn't work with the Panel, it displays a "Variable $my_variable is not declared", I assumed this is because this variable is create with the Form (Before Show) and this event occurs after the Panel is created.

So I'm trying to create the variable at search, and then use the Panels Before Show event to hide it. I've tried all the events available for the Search form, even the OnClick of the Search Button, but stills the variable is empty.

any clue on what I'm doing wrong?
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 04/19/2013, 9:44 PM

You could use custom code in the before show event

if($variable == whatever){
$panel->visible = false;
}


$panel->visible = false;
if($variable != whatever){
$panel->visible = true;
}
_________________
Central Coast, NSW, Australia.

View profile  Send private message
DataDoIT
Posted: 04/20/2013, 12:53 AM

Globalize your variable so you can use it in the other functions. Each
'event' in CodeCharge is simply a function. So if a variable is defined
within that function, it's scope is only available within that function.

You can use the Declare Variable action. So in your record form's Before
Show, add a Declare Variable action before your Dlookup action. The
generated code will look something like:

//Declare Variable @256-3BE6D7AF
global $MyVariable;
$MyVariable = null;
//End Declare Variable

//DLookup @255-13B29B12
global $DBConnection1;
$Page = CCGetParentPage($sender);
$ccs_result = CCDLookUp("yada", "blabla", "id=" .
CCToSQL(CCGetParam("id", ""), ccsInteger),
$Page->Connections["Connection1"]);
$ccs_result = strval($ccs_result);
$MyVariable = $ccs_result;
//End DLookup

More info: http://php.net/manual/en/language.variables.scope.php

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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