on ‎2019 Nov 26 9:15 PM
I am having an issue with shared variables that are going from my subreport to my main report. In my subreport I want to pass the sum of the formula ActualCFS and the count of field tbnatur.desc to my main report. I will focus on just one of these, as whatever the problem is with one seems to be the same problem with the other. In a nutshell, these formulas give me exactly what they should when they are on the subreport, so I feel they are working properly. The problem is that the value that is passed to the main report for both formulas are both exactly 554 short of what they each should be.
I have this formula in my subreport:
Shared NumberVar CountCFS;
CountCFS := CountCFS + Sum ({@ActualCFS});
CountCFS;
I have this formula in my main report:
Shared NumberVar CountCFS;
CountCFS
Again, when I place the formulas on the subreport they are correct. But the values on the main report are both short of what they should be by 554 and I absolutely cannot figure out why.
Request clarification before answering.
1. Are you initializing CountCFS to 0 in the main report before the first time the subreport is called? The best way to do this would be in the report header section with a formula that looks like this:
Shared NumberVar CountCFS := 0;
""The empty string at the end ensures that it doesn't display anything.
2. What type of section are you displaying it in? Is it AFTER all of the subreports have run? The variable won't have a complete value until after they've all run.
3. Try constraining which pass the variable is calculated in by making "WhilePrintingRecords;" the first line in all of the formulas.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. I have added this into the report header.
2. I do have the shared value after the subreport has ran. Again, it's passing a value, it's just 554 short of what it should be passing. I know the formula on the subreport end are good because all of the math is correct there. It just gets wonky on the main report.
3. Added WhilePrintingRecords;
Tried all of these suggestions and it is still displaying the incorrect value on the main report.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.