Send Subreport Parameter to main report parameter

2019-06-12 05:01发布

I am using Crystal Report, and I want to display the value of shared variable in Main Report that will change from Sub Report. I know, this is a very old topic, and there are solutions available on the internet and stackoverflow also.

Crystal Reports: How to pass a parameter from a subreport to the parent report?

http://www.ehow.com/how_5287432_use-shared-variable-crystal-report.html

I tried both solution but none of them is working. I am sure something I am missing. I am just started working on crystal report, so It could be little mistake.

What I tried?

I have created a formula in Main report named f_main and added

Shared NumberVar balance;
balance := 0;

Now I have dragged it on main report to see the output. Of Course output would be 0 only. then I added a new formula in subreport named f_sub. add added

Shared NumberVar balance;
balance := 5;

Now output would be 5 in subreport, but I want to display the same output(mean 5) in main report also. How ? I tried above post, but I am sure something I am missing. Please help what I am doing wrong.

1条回答
We Are One
2楼-- · 2019-06-12 05:49

For eg: if you have a main report say 'MainReport' and sub report named 'SubReport' and you have @mainFormula and @subFormula in 'MainReport' and 'SubReport' respectively. Formula fields are just like other fields. You can add those fields to your report so that they show up when you run the reports. To solve your issue, if you are using @subFormula in 'SubReport' to show/display the value when running report, try removing it.

查看更多
登录 后发表回答