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

 LEFT() in Where clause? [SOLVED]

Print topic Send  topic

Author Message
yourguide


Posts: 44
Posted: 07/16/2012, 9:32 AM

Is it possible to use the LEFT() command in a where clause? like this:

SELECT Nbr, ItemCodeDesc
FROM ics
WHERE Nbr = 'left({UrlNbr},5)'

Or some other way to just get the first five characters in the variable I read from the URL?
In php I would normally use SUBSTR but I am trying to figure out the most "CodeCharge Friendly" way of doing this without writing custom code.

In the code itself I only see "FROM ics {SQL_Where} {SQL_OrderBy}";
so I can't just edit that line to include my LEFT() for MySQL since apparently the SQL_Where is being built elsewhere.


_________________
Independent, self-employed, web developer.
View profile  Send private message
DataDoIT
Posted: 07/16/2012, 12:50 PM

In your grid/record's Data Source, add a WHERE Table Parameter and set
something like:

Condition Type: Expression
Expression:
myField=" . CCToSQL(substr(CCGetParam("UrlNbr", ""), 0, 2), ccsText) . "

We're telling CCS to break out and do some other PHP stuff. The
placement of the double quotes is important. Look in your myPage.php
code under the Prepare Method or Prepare() function and you'll see the
code it created, which will look similar to:

$this->wp->Criterion[1] = "( myField=" .
CCToSQL(substr(CCGetParam("UrlNbr", ""), 0, 2), ccsText) . " )";
yourguide


Posts: 44
Posted: 07/17/2012, 10:42 PM

THANK YOU! This worked perfectly!
I sure wish I could sit behind you for a week or so while you worked with CCS. :)
:-)
_________________
Independent, self-employed, web developer.
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.