cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass all values to subreport in crystal reports

Former Member
0 Kudos

how to pass all values to subreport in crystal reports. I have a parameter which has default value 'All', I want to pass to sub report. How to pass it?

I am passing through sub report link , I am getting zero value instead of showing all values in the report.

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ian,

Your suggestion is working for 1 parameter;

I am passing two parameters {?p} and {?pl1} from main report to subreport. I have created two parameters {?p} and {?pl1} in sub report and I have written the below in record selection of sub report and linked two parameters of sub report to parameters of main report in sub report links in main report.

IF {?p}= 'ALL' AND {?pl1}='ALL' THEN

{pole_.polename} LIKE '' AND {pole_.pl1} LIKE ''

ELSE IF {?p}='ALL' AND COUNT({?pl1})=1 THEN

{pole_.polename} LIKE '*' AND {pole_.pl1}={?pl1}

ELSE IF COUNT({pole_.polename})=1 AND {?pl1}='ALL' THEN

{pole_.polename}={?p} AND {pole_.pl1} LIKE '*'

ELSE IF COUNT({pole_.polename})=1 AND COUNT({?pl1})=1 THEN

{pole_.polename}={?p} AND {pole_.pl1}={?pl1} ELSE

FALSE

I am getting this error: COUNT({?pl1}) : field can not be summarized

My requirement is to pass three parameters from main report to sub report. Parameters will have 'ALL' values or single value selection.

I am trying for 2 parameters, later I will work for 3 parameters.

thanks

Former Member
0 Kudos

If Parameter can only have value 'All' or another single value this should work

IF {?p}= 'ALL' AND {?pl1}='ALL' THEN

{pole_.polename} LIKE '' AND {pole_.pl1} LIKE ''

ELSE IF {?p}='ALL' AND {?pl1} <> 'ALL' THEN

{pole_.polename} LIKE '*' AND {pole_.pl1}={?pl1}

ELSE IF COUNT({pole_.polename})=1 AND {?pl1}='ALL' THEN

{pole_.polename}={?p} AND {pole_.pl1} LIKE '*'

ELSE IF COUNT({pole_.polename})=1 AND {?pl1} <> 'ALL' THEN

{pole_.polename}={?p} AND {pole_.pl1}={?pl1} ELSE

FALSE

Ian

Answers (3)

Answers (3)

Former Member
0 Kudos

Right Click on SubReport And Select "Change SubReport Links..."

1) Select all fields that you want to display in subreport and move from "Available Fieles" to "Fild(s) to link to:".

2) If you want to display all fields without any criteria, than do not assign any relationship between subreport and main report.

3) Click OK.

4) Open SubReport and you will find that field(s) under Parameter Fileds starting with "Pm-"

5) Put that field in Detail Section of your subreport.

Run Report......

Former Member
0 Kudos

I am passing 'ALL' parameter i.e. null value from main report to sub report.

But as you said what tshould be in record select of sub report?

please clarify.

Former Member
0 Kudos

Create a parameter in the subreport and use it to filter the records as required. Then link the main report param to the subreport param. remove all other existing links

Ian

Former Member
0 Kudos

Not sure what you are trying to do?

You could try creating a parameter in Subreport which has same function as main report wilth an All option, and then use that in the SR record selection.

You can then link the Main report Param to the SR param

In SR links dialog box, drag main param into linking window, then in lower left hand drop down list, scroll down to find SR param and link them together.

Ian