问题
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:
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.
来源:https://stackoverflow.com/questions/18296860/send-subreport-parameter-to-main-report-parameter-in-crystal-report