Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiple value Parameters Post Reply Post New Topic
Author Message
tin337
Newbie
Newbie


Joined: 04 Nov 2011
Online Status: Offline
Posts: 11
Quote tin337 Replybullet Topic: Multiple value Parameters
     Posted: 04 Nov 2011 at 8:24am

Hello... I'm having problems with trying to set up a parameter which will give the end user the option of either selecting all values from a selected column or selected combination of values. Below is the script I'm using to access the data. I'm able to do the multiple select with no problem, but when I tried the 'All' option, there is no result. Any help is much appreciated.

 

select Company_Name

,Accounting_Unit

,Account_Unit_Description

,sum(Ending_Balance) as Ending_Bal

from GENERAL_LEDGER

where Company_Num = {?CompanyNbr}

And BALANCE_TIMEPERIOD = {?FiscalYear}

And (left{Accounting_Unit,2} in{?AcctUnit} or {?AcctUnit} = 'All')

group by Company_Name ,Accounting_Unit ,Account_Unit_Description

order by Company_Name ,Accounting_Unit ,Account_Unit_Description

IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 04 Nov 2011 at 9:36am
im to sure i understood your question correctly.
create parameter as a number(or  string) in the select export
write something like
(if parameter = 1 then field = some values else
if parameter = 2 then field = field ( for all values))
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 04 Nov 2011 at 10:30am
If you're using a static parameter, you can define the values the user is able to select. Be sure one of those is 'ALL'. Then, navigate to Report>Selection Formulas>Record. Here is where you will define how the report pulls the data based on the parameter.

Let's say your parameter is {?Name}. If you specified 3 names (John Doe, Jane Doe, Jim Doe) and 'ALL', your formula would look something like:

({?Name}='ALL'
and
{table.namefield}={table.namefield})

or

{table.namefield}={?Name}



|< /\ '][' ( )
IP IP Logged
tin337
Newbie
Newbie


Joined: 04 Nov 2011
Online Status: Offline
Posts: 11
Quote tin337 Replybullet Posted: 04 Nov 2011 at 10:39am

I guess first off – I’m a renew newbie… I haven’t used crystal report in years, so I’m sure there are new features that I’m not aware of, but my current problem is that I’m trying to create a report with the above sql statement passing 3 variable fields. The first 2 variables/parameters (CompanyNbr  & FiscalYear) are required and can only have one values each per time a user runs the report. It’s the 3rd variable/parameter that I’m having problem with, in which, I would like the user to have the option of either entering 1 unit, a combination of multiple units or ‘All’ (which returns everything).

The problem I’m facing right now is, with the current SQL script, I’m able to enter one or multiple units for the third parameter, but when I try using just the ‘All’ value to return every unit type, it returns nothing.  If I replace:

 

(left{Accounting_Unit,2} in{?AcctUnit} or {?AcctUnit} = 'All')

 

with just             

{?AcctUnit} = ‘All’

 

I’m able to use the value/option ‘All’ to return all records with any unit type.

I hope I didn’t confuse you even more.

 

Thanks for the help…

 

IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 04 Nov 2011 at 10:55am

try this


select Company_Name

,Accounting_Unit

,Account_Unit_Description

,sum(Ending_Balance) as Ending_Bal

from GENERAL_LEDGER

where Company_Num = {?CompanyNbr}

And BALANCE_TIMEPERIOD = {?FiscalYear}

And (left{Accounting_Unit,2} in{?AcctUnit} or left{Accounting_Unit,2} = left{Accounting_Unit,2} )

group by Company_Name ,Accounting_Unit ,Account_Unit_Description

order by Company_Name ,Accounting_Unit ,Account_Unit_Description

IP IP Logged
tin337
Newbie
Newbie


Joined: 04 Nov 2011
Online Status: Offline
Posts: 11
Quote tin337 Replybullet Posted: 04 Nov 2011 at 11:21am

What does “left{Accounting_Unit,2} = left{Accounting_Unit,2}” do? I tried it in my script and same thing, I’m able to enter multiple units but still unable to have the report return all units

 

 

IP IP Logged
tin337
Newbie
Newbie


Joined: 04 Nov 2011
Online Status: Offline
Posts: 11
Quote tin337 Replybullet Posted: 04 Nov 2011 at 12:09pm

As I said.. I’m a re-new Newbie… hahaha…  it took me a little while to figure out what FrnhtGLI was doing.. but I think it’s finally got it to work.

 Thanks for the help… both FrnhtGLI and kostya1122

IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum