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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIONs and Parameters

Status
Not open for further replies.

PTW

Programmer
Jul 7, 2000
82
CA
Hello. I have created a report where I have two tables in a UNION. The fields on the report itself are from only one table, and I have entered the SELECT statement manually.

I need to use dates in both WHERE clauses. Currently those dates are hard-coded in, but I would like to use Parameters so they can be changed each time the report is run. Unfortunately, the only way I know how to add parameters to the SELECT statement is by using the "Edit Selection Formula", which destroys my old SELECT statement.

Is there a simple way to add Parameters to a SELECT statement or am I on the wrong track entirely?

Thanks! [sig][/sig]
 
I have some what of a similar situation as to yours. I'm not sure if this helps since because I'm using the Seagate Info 7, formerly known as Crystal Info. With Seagate Info 7, you can create a report based on a query written in Info SQL Designer. Then in the Info Report Designer, you can use either the Edit selection formula or selection expert to put in the parameters for the dates. Hope it helps. [sig][/sig]
 
Try something like

Select a, b, c
from myfile
where
d = 1
and date = {?p_date}
union
select a, b, c
from myfile
where d = 2
and date = {?p_date}

where p_date is your parameter.

In other words, just edit your select directly.

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top