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

Problem with Multi Parameter and string field 1

Status
Not open for further replies.

njahnavi

Technical User
Dec 29, 2008
136
US
Hi I am using crystal reports version XI release 2
I have a "Teams" parameter in report which can take the multi values.I have a "Leads" field in the database.

The leads filed contain names of leads seperated by commas.
Since the leads can be more than one so we have stored the leads names in the Leads field seperated by commas.

Here is the sample data for Leads Field

'Mark roaster, John Italina,Raghu via'
'jack ride,jim clark'
'janu chin,joy ult'

Suppose the user has given these names in "Teams" parameter

Mark roaster
jim clark
Raghu via

Then the report has to select only the rows if they have alteast one of them.

so from the sample data we get
'Mark roaster, John Italina,Raghu via'
'jack ride,jim clark'

Any help is greately appreciated.




 
There might be a better way to do this. The following works, but will not pass to the SQL:

numbervar i;
numbervar j := ubound({?Teams});
stringvar array x;
for i := 1 to j do(
if {?Teams} in {table.leads} then (
redim preserve x[j];
x := {table.leads}
));
{table.leads} in x

-LB
 
Thanks Lb.

I have used the same logic however changed a little bit.
I have used it in a formula so that it will return boolean value and I have kept that formula in the report seelection area.

 
Well, the formula I suggested could have been placed directly in the record selection formula area, since it returns a boolean also.

-LB
 
Hi Lbass and jahnavi,

i have one question.

if {?Teams} in {table.leads} then (
redim preserve x[j];
x := {table.leads}
));
{table.leads} in x

in above code, is {table.leads} contain all rows of column or only one raws ata one time in loop ?

your help is greatly appriciated.

thanks.
 
I have used the following formula which is the logic provided by LB.

booleanVar cdtnVal := false;

if length({table.leads}) > 0 then
(
stringVar teamleadsstring := {table.leads}
if {?Teams}= "All" then
cdtnVal := true
else if {?Teams}= "" then
cdtnVal := false
else
(
numbervar i;
for i := 1 to ubound({?Teams}) do
(
if {?Teams} in {table.leads}
then cdtnVal := true
);
);
)
else
cdtnVal := false;

cdtnVal



And kept that in the suppress formula of the details section.
So in my case it will have only one row records at a time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top