Parameter Value in main report is not passed to a parameter in the subreport

StackOverflow https://stackoverflow.com/questions/23342178

  •  11-07-2023
  •  | 
  •  

سؤال

I need your assistant in passing a value of a parameter in the main report to the subreport. I defined a parameter in the main report which is called {?ReportNumber} and its type is Number and it is static.

In the Select Expert of the Main Report I added the below code:

{engine.reportnumber}={?ReportNumber} 

This will take the value of the reportnumber from the table and it will assign it to the parameter. Each time I ran the report, the value will be different based on the retrieved data.

In the Subreport, I created again a parameter with the same name {?ReportNumber} and its type is Number and it is static.

I have added a subreport link which is {?ReportNumber} parameter and below I selected to match the {?ReportNumber} parameter which is in the subreport.

However my issue is that when I ran the report, the report is prompting me to enter the parameter of the subreport, even though I have added and assigned a value to it as I have explained in the above steps.

I am using Crystal Reports 2011

Even tried to use shared variable in the main report:

shared numbervar report_number := {engine.rptno}; 

report_number; 

In the sub report, I create a formula ("Shared_report_number") and I placed it in the report header. It has the code:

shared numbervar report_number; 

report_number; 

I clicked on Select Expert and then I chose the field {engine.rptno} is equal to {@Shared_report_number}, it produces an error that : the formula cannot be used because it must be evaluated later

Kindly assist me in passing the value of the parameter from the main report to the subreport.

هل كانت مفيدة؟

المحلول

This prompting shows that your parameter is not link properly.

When you link the parameter. In left side, main report parameter show 1. is of sp parameter 2. is of custom report parameter

While you linking, note that you custom report with report name is joined.

Please check this below link, in UI potion of third image , right-bottom side you have to choose sub-report parameter. So check and then link.

http://blog.niklasottosson.com/?p=1137

In your case, I think your main report parameter is link with itself. not with subreport parameter.

Check this link carefully while mapping.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top