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 -> General/Other

 Dynamically modify WHERE clause

Print topic Send  topic

Author Message
PunyaAK
Posted: 04/20/2005, 11:53 PM

Hi,

I have GRID with data source SQL. I'm using 'Before Build Select ' to dynamically modify the WHERE clause.
But I get the following error whenever WHERE clause is appended with search criteria:

"ORA-00920: invalid relational operator
ORA-00933: SQL command not properly ended"

Here is the code in Java:

if (!((SqlParameter)e.getParameter("s_NAME")).getValue().equals("")) {
e.getCommand().setWhere(e.getCommand().getWhere() + " AND 1=1");
}


Am I missing anything?

Punya
mrachow


Posts: 509
Posted: 04/25/2005, 2:37 AM

It's possible that where parameters resulting from search parameters and grid datasource parameters are added later to the where clause.

So I would recommend to check
e.getCommand().getWhere() .length
first and then decide to use AND or not.

Hope this helps.
_________________
Best regards,
Michael
View profile  Send private message
PunyaAK
Posted: 04/25/2005, 9:23 AM

OK. Here is the response from CCS technical support:

"When you use Table Data Source type, query is split and stored in separate properties: SQL, Where and Order. You can use setSQL, getSQL, setWhere, getWhere, etc. methods to set or get queries parts.

But with SQL Data Source Type, entire query is stored in SQL property. Where and Order are empty and just are not used. That’s why with custom SQL data source you need to work with SQL and use setSQL/getSQL methods."


So I used setSql() and and it's working :-)

Punya

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.