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

Select expert - work with OR function ?

Status
Not open for further replies.

gazol

Technical User
Jan 29, 2004
31
SE
I have crystal reports 8.5 and making a report with parameters. I´m select time and to fields containing id:s. (Groupe_id or id, Groupe_id contains groupes with id:s)

The tables look like (and linked equal from id to id.)

----------- ---------
|Table_1 | |Table_2|
----------- ---------
|Groupe_id| |Name |
|id | --->|id |
| | |Time |
| | |Type |
----------- ---------
From table_1 the parameter gets the groupe_id
From table_2 the parameter gets time and the id

When i run the report i need to select the time and select the groupe_id OR the id.

The reports works fine separatly but when i run the report with the selection in select expert with "groupe_id or id and time" the problem starts. The time selection disapears and the report fetches everything from the database without selecting the records in my time period.

How can i use the select expert to get the groupe_id or the id.

I need the report to be run with parameters so that the one running it can choose to run the report on the groupe that contains a groupe of the id:s or just one or more id:s that dont belongs to a groupe or not the same groupe.

Shortly: Can i use the OR function in select expert, i don´t get it to work ?

Everything else in the report works fine and separatly there are no problems with this.

Please help me ! :)


 
Now my select expert looks like:

{Table_1.Group_id} = {?groupe_id} or {Table_2.id} = {?id}
and {Table_2.Time} = {?timeintervall}

The timeintervall doesen´t work !
-

When i do this it works perfect.

{Table_1.Group_id} = {?groupe_id} and {Table_2.Time} = {?timeintervall}

Any ideas ?? :)
 
When you say it "doesn't work", that is a very broad statement. Please give some sample data of what your report results currently look like versus your desired output.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
askdon@srhconsulting.com
 
Try this

{Table_1.Group_id} = {?id} OR
(
{Table_2.Group_id} = {?id} and
{Table_2.time} = {?timeinterval}
)


Cheers,

-LW
 
I think you should set up a separate string parameter {?whichID} with options "GroupeID" and "ID". Then change the selection formula to something like:

if {?whichID} = "GroupeID" then
{table1.GroupeID} = {?GroupeID} else
if {?whichID} = "ID" then
({Table_2.Id} = {?id} and
{Table_2.Time} = {?timeinterval})

If you use the "or" approach, if a record doesn't meet the first parameter criterion, it will be evaluated against the other, and I think you really want them only evaluated against whichever criterion the user chooses.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top