CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Sql Creation Problems

Print topic Send  topic

Author Message
Andrew B
Posted: 10/17/2002, 8:16 PM

I am having a prob. getting CCS to do exactly what I want with SQL statements. Here is my problem :

I need to use 'DISTINCT' in one of my queries (don't ask, i didn't do the data), as well as search on 5 of the fields. When I do this the normal way in the builder, the 'table' method, I can get all my searches in there just fine. If I don't search it doesn't use any search params, but it doesn't let me use 'DISTINCT'!

If I use the 'SQL' route and hand code my query I can use distinct. However, it appears to always include the search params (i.e, WHERE MyID={MyID}) which makes it fail or go wrong since it searches for blank numbers or the defaults.

Is there any way around this? I understand the issues for the CCS guys in making the generic query engine, but it would be nice to have a 'SQL with AutoParams' selection in the 'Data Source Type' dropdown. If there is a good way to combine the two, that would be great.

Thanks,
Andrew
Ryan
Posted: 12/08/2002, 4:45 PM

I am having the same problem and would appreciate a response.
Martin
Posted: 12/09/2002, 4:59 AM

In situations like this I have found it best to create a separate "View" comprised of the sql query and incorporating the "DISTINCT" clause in the sql view.

Select this "view" rather than using your hand coded sql... and pass the params as you normally would.


AndrewI
Posted: 12/09/2002, 4:59 AM

Try:

WHERE ... AND ( MyID = {MyID} OR {MyID} = '' ) AND ...

So, if {MyID} is a search parameter, the first part searches for it in the normal way. If {MyID} is blank (''), the second part of the clause is True, and all records are returned. You can do this for a number of different search fields, but note the bracketing.

-I tend to set up the parameter (in the SQL builder) for IDs so that the default value is 0. Then I use the following, which avoids any problem with the quote marks:

WHERE ... (MyID = {MyID} OR {MyID} = 0) ...

   


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.