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. |
|
|
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. |
|
|
|