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

Hi, I want to use the Select Expert 1

Status
Not open for further replies.

diannelight

Technical User
Feb 24, 2003
59
US
Hi, I want to use the Select Expert in my report that allows me to select fields according to the parameter I have created. However, my query needs to read eg.
{field name} = {?Parameter} or {different field name} = {?Parameter}.
My results aren't correct - is it possible to have this kind of query?
Thank you.
 
Dear Diane,

If you are indicating that you want different database fields returned by the select query itself and not the values for fields to meet a criteria then you would have to base the report on a stored procedure. Pass the parameters to stored procedure to retrieve the fields that you require.

If that is not the issue could you please restate your issue and provide an example of the data you expect to retrieve?

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Assuming you are dealing with text fields (big assumption) you could also take advangtage of the 'like' option. Change your selection statement to use like instead of =. Then, make the default value for both of your parameters an asterix (*). This is the wildcard value, so if an asterix is entered in both parameters, all records will be returned. If it's just entered in one, and a value is keyed into the other parameter, then all records match the entered value will be returned.

Another option would be to create two parameters - one to capture the value to use as criteria {?Value}, one to select which field to base the criteria on {?Field} e.g. Enter 1 for Customers, enter 2 for Part Numbers. You would then create a formula {@Output} that used the value in the parameter to return the correct field e.g.

if {?Field} = '1' then {table.customer} else {table.Part Number}

You would then simply change your selection criteria to compare the value entered in parameter one, with the result of the above formula.

{?Value} = {@Output}

Peter Shirley
 
Taking your question at face value, the answer is 'Yes', there is no reason why a record seelction criterion can't be specified as:

({field name} = {?Parameter}) or ({different field name} = {?Parameter})

Please specify in what way the results are not as expected. Also, make sure you didn't specify the wrong options in your parameter design (range, multi-value, ...).

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
CrystalReporting,
Your assumption is correct! I applied your suggestion of using the 'like' option and it works, although only when I put the fields in the select expert in a particular order (?).
And for the default value, I used '?' not '*'.
Thank you for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top