Former Member

# Need tip to write a formulae

my report looks like this :

SelectionCritera:ProductID is '10' and AccountID is '00000' and city is 'VA'

-

ProductID AccountID City

-

10 , 0000 , VA

can somebody tell how to write the formulae(logic) for the SelectionCritera to be displayed as shown above, in crystal and one more thing all ProductID ,AccountID and City have promts on them.

10|10000 characters needed characters exceeded

Former Member
Sep 26, 2008 at 04:06 AM

Hi Sai,

You can create a formula as

stringvar selection;

selection:= 'Selection criteria : ';

selection:= selection & 'ProductID is : ' & chr(39) & & chr(39);

selection:= selection & ' and Account Id is : ' & chr(39) & & chr(39);

selection:= selection & ' and city is : ' & chr(39) & & chr(39);

Hope this is your expected solution.

10|10000 characters needed characters exceeded
• Former Member Former Member

Hi Sai,

I tried your formula but there are some mistakes in it.

I modified it. Please try the following as it is. it is working at my end when I tried with multi valued numeric parameter.

stringVar array arr1;
stringVar selection;
numberVar i;
redim preserve arr1[count({?ProductID})];
for i:=1 to count({?ProductID}) step 1 do
arr1<i>:=totext({?ProductID}<i>);
selection:= 'ProductID is : ' & chr(39) & join(arr1,",") & chr(39);

Please check the parameter name is correct or not.

Regards,

Raghavendra

• Former Member
Sep 30, 2008 at 04:35 PM

i think you can do this much simpler.

do you want to retrieve records based upon parameters? (ProductID ,AccountID and City have promts on them)

if that is the case and the end user can retreive all records or make a selection of one or a combo of all of the above

in the parameters add ALL as the first selection.

in the selection criteria

(if {?ProductID}='ALL' then true else {ProductID)={?ProductID})

create that for all 3, use and or statement between them if they only select one. if they have to select all of the them use and and statement.

10|10000 characters needed characters exceeded
• Former Member Former Member

are the parameters set up with allow multiple values checked?

does it work with range of values checked?

• Former Member
Oct 03, 2008 at 12:58 AM

Hai Raghavendra,

Thanks a lot ,It helped me a lot.

I have few more question on sm stuff like this which i'll be posting ,so please kindly answer them if you can