Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More Wildcard Parameter Problems

Status
Not open for further replies.

robinsql

Programmer
Aug 2, 2002
236
IE
I need to know if there is a wildcard character for a number field parameter. I am using crystal reports from the web and passing parameters into the where clause of my SQL Query via a URL string.
SELECT
VFleetSurvey.* FROM
Database
WHERE
ClientID = 123 AND '123 and 176 are the params
DepotID = 176
ORDER BY
ClientName ASC,
DepotName ASC
This works fine if I want to see the details for this particular client and depot, but if I want to see the details for this client and all depots associated with it, how can I pass in the parameter without changing the SQL query. Is there a like clause that I can use with numbers?
Something like
WHERE
ClientID = 123 AND
DepotID like *
 
I generally set this up using parameters in the Crystal Report.

So the record selection criteria would look like:

If {MyTable.DepotID} <> 0 then
{MyTable.DepotID} = {?MyClientParm}
else
true

Then just pass 0 when you want all rows.

-k kai@informeddatadecisions.com
 
Thanks, but I'm not really sure what you mean. I'll try to explain a bit better.
SELECT
VFleetSurvey.* FROM
Database
WHERE
ClientID = {?glClient}AND
DepotID = {?glDepot}
I am passing these params in from the web. They are in the number range 1 - 10000. Each ClientID will have several related DepotID's. I can select any of the following from the website:
One client and one depot.
One client and it's associated depots.
All clients and all depots.

Any ideas? Thanks.

Is this possible?
 
How was or is this report being created?

When you state via the web, I had assumed that the report was developed using Crystal Reports, inclusive of the parameters.

Hence if you add something akin to the above to the record selection criteria to the report itself, it will pass along the proper where clause.

Perhaps you're constructing the report on the fly? Or creating the datasource on the fly?

-k kai@informeddatadecisions.com
 
Thanks for the help synapsevampire,
I solved it using a record selection formula
Robin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top