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

Working with multiple values in Parameters 1

Status
Not open for further replies.

CraigBest

Programmer
Aug 1, 2001
545
US
Looking for some help...

I have a parameter with Multiple values I'm passing into a report, and I want to use the values in the parameter to restrict the results of the completed report. In this case, it's a General Ledger account #, and the report has a section that breaks on the G/L #.

How do I write the code in the record selection formula to allow the report to let through any value that matches one of the passed G/L #'s? If I were writing SQL code I'd use the IN operator. Can someone point me in the right direction using Crystal syntax?

Thanks

Craig in NJ
 
What version of Crystal are you using?

The solution is probably:

{MyTable.GL} = {?MyParameter}

Make sure that you check the Show SQL Query after you enter the values, it should build something like:

{MyTable.GL} = 1 (whatever values you entered)
or
{MyTable.GL} = 2 (whatever values you entered)
etc...

Note that an IN is less efficient than passing specific values using ORs.

-k kai@informeddatadecisions.com
 
Using a record selection formula, "IN" is the way to go.

{YourField} in {?MultiValueParameter}

Should work Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Thanks dgillz, I think that should work. Can't prove it yet as I'm having trouble trying to connect to my datasource (another issue) but it seems to me this ought to work.

Craig in NJ
 
Sorry, I should have better qualified, an IN is more efficient when writing SQL code, Crystal will change this to = and ORs for the exact same reason.

I was responding to Craighartz statement that he'd use IN when writing SQL code.

-k kai@informeddatadecisions.com
 
Ooops:

This:

Sorry, I should have better qualified, an IN is more efficient when writing SQL code, Crystal will change this to = and ORs for the exact same reason.

Should be:

Sorry, I should have better qualified, an IN is LESS efficient when writing SQL code, Crystal will change this to = and ORs for the exact same reason.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top