cancel
Showing results for 
Search instead for 
Did you mean: 

Showing records based on parameter value

Former Member
0 Kudos

Hi All,

I need to show my report based on parameter value selected.

I created a parameter called records.So if I gave value as 1 then it should show only 1 record.

I tried in record selection like this.But not getting the result.

WhileReadingRecords;

numberVar x :=x+1;

if x = {?record} then false

Accepted Solutions (0)

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Divya,

Change the code to:

WhileReadingRecords;

numberVar x :=x+1;

x <= {?record}


-Abhilash

Former Member
0 Kudos

Hi Abhilash,

Actually my record number is coming from sub report via shared variable.

In this case what I have to do

I tried below code but throwing error

WhileReadingRecords;

shared numberVar a;

x <= {?record}



In sub report I already created a running total and assigned that value to a.



abhilash_kumar
Active Contributor
0 Kudos

You cannot use a Shared Variable in the Record Selection Formula.

I'm sorry, but what are you actually trying to do?

-Abhilash

Former Member
0 Kudos

Hi Abhilash,

I have a main report where I am displaying location details and passing some value to sub report using links tab.

Every time my main report displays only 1 record.don't consider main report.

My requirement is in my main report I have a parameter record .

if I gave record =1 then my sub report should show only 1 record.

Thats why I am pulling record number from sub report to main report.

Please suggest

abhilash_kumar
Active Contributor
0 Kudos

Hi Divya,

If you're trying to filter the subreport based on Main Report's prompt, here's what you need to do:

1) Right-click the Subreport > Change Subreport Links > Move the prompt in the Main Report to the Pane on the right > uncheck the option 'Select data in subreport based on field'

2) Get inside the Subreport's Design page > Go to Record Selection formula and use this code:

WhileReadingRecords;

numberVar x :=x+1;

x <= {?Pm-Prompt_from_Main_Report}


-Abhilash

Former Member
0 Kudos

Hi Abhilash,

To which field/parameter coming from sub report I have to link from main report parameter ? .

I did like you said but in sub report record selection formula I am getting error like this.

abhilash_kumar
Active Contributor
0 Kudos

You need to send the Main Report's prompt into the Subreport and use that prompt in the Subreport's record selection formula.

Step 1 will send the prompt into the Subreport

Step 2 will use that prompt and filter the records in the Subreport. The prompt from the Main Report will look something like this when viewed in the Subreport's formula window :

{?Pm-promptname}

-Abhilash

former_member205840
Active Contributor
0 Kudos

Hi Divya,

Once you link main report parameter to your sub report, you will see that parameter under Parameters in your sub report with {?Pm-parameter}

In Record Selection of your sub report, take {?Pm-parameter} prompt in place of {?REC}

-Sastry