0
votes

I have a crystal xi report with a main report and lots of subreports.

I have linked all the sub reports to 2 parameters which works perfectly well for individual matches of criteria, however I now need to be able to chose multiple criteria for one of the parameters which I can set up but it just doesn't pass the details to the subreports.

This is what I have currently in my main report record selection

{Communication.Comm_Status} = "Complete" and
isnull ({Communication.Comm_Deleted}) and
{Communication.Comm_Action} = "PhoneOut" and
{Communication.comm_Result} in ["0", "1", "2"] and
not ({Communication.Comm_UpdatedBy} in [30, 33, 59]) and
{Communication.Comm_DateTime} in LastFullWeek and
{Territories.Terr_Caption} = {?Client} and
{Company.comp_campaign} = {?Campaign}

and this is what I have in my subreports record selection

isnull ({Communication.Comm_Deleted}) and
{Communication.Comm_Status} = "Complete" and
{Territories.Terr_Caption} = {?Pm-Territories.Terr_Caption} and
{Territories.Terr_Caption} = {?Pm-Territories.Terr_Caption} and
{Communication.comm_Result} in ["0", "1", "2", "3", "4"] and
not ({Communication.Comm_UpdatedBy} in [30, 33, 59]) and
{Communication.Comm_DateTime} in LastFullWeek and
{Company.comp_campaign} = {?Pm-Company.comp_campaign}

I suppose what I would ideally like is '=' parameter1 and 'contains' in parameter2

I have tried to search for resolutions, but I don't know what terms I should be looking for join; multi-value parameter or something else?

Thanks in advance for any guidance.

1

1 Answers

0
votes

I'm not quite sure in your example which paramter is which, but you could do something like:

({tableName.tableField} = {?parameter1} AND
InStr({tableName.tableField}, {?parameter2}) > 0)

That would make sure that your field is equal to parameter 1 and that parameter 2 is contained in the field. You may need to convert your field to a string if it is a different data type.

EDIT:

Sorry, I guess I've not been paying 100% attention to the question. If you have a multi value parameter, then you have to treat it like an array (that's why you got the error with my original formula). In order to loop through the array, you need to create a formula like so:

 WhilePrintingRecords;
 numbervar x := 1;
 numbervar y := 0;

 while x <= ubound({?Campaign})

 do
 (if instr({Company.comp_campaign},{?Campaign}[x],1) > 0
 then y := y + 1;
 x := x + 1);

 y

EDIT:

 WhilePrintingRecords;
 stringvar array campaign := {?Campaign};
 numbervar x := 1;
 numbervar y := 0;

 for x := 1 to ubound(campaign)
 do
 (if instr({Company.comp_campaign},{?Campaign}[x],1) > 0
 then y := y + 1;
 x := x + 1);
 y

Then in your record select you need to check for the formula > 0.