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

 Global Variable to use in SQL where statement

Print topic Send  topic

Author Message
rla

Posts: 18
Posted: 07/26/2009, 1:47 PM

Hi,

I have a global variable that I want to use in the mySQL where clause. Is there a way to use it in the Data Source screen or is there a way to modify the where before it executes?

Thanks
View profile  Send private message
jjrjr1


Posts: 942
Posted: 07/26/2009, 2:42 PM

Sure

In your beforeBuildSelect event add some code like this

  
global somevalue;  
  
$Component->ds->Where = 'some condition=somevalue';  

This will replace any existing where statement

You might have to do something like this if your where statement can be different in any case

  
global somevalue;  
  
if($Component->ds->Where=="")  
{$Component->ds->Where = ' some condition=somevalue';}else  
{  
$Component->ds->Where .= ' AND some condition=somevalue';}  

Note: it could also be OR depending on your need



_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message
rla

Posts: 18
Posted: 07/26/2009, 3:06 PM

Thanks that did the trick.
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.