Reputation: 131
I have a report where I have several subreports and one way I found to get a SUM of each subreport to be displayed at the main one, was to use a shared variable.
The problem is that when I open a report on my application, it will actually generate several dozens or even hundredes of reports, as this is a anual leave report with all the absences of employees per year.
The first report comes out ok and all the values are correct.
But when I click next to see the next employee report, the shared variable value stores the previous employees value of holidays taken that year and displays the second employees Holidays on top of that value.
Example:
First report, employee has 20 holidays taken. Values are correct. If the next employee has 15 holidays taken, the report will show as if he has 35.
I know the problem is that the shared variable is keeping that number on record and just adding up, I'm just not sure how to reset it and make it an unique value per employee.
For some extra info:
My shared variable is created like this:
shared numbervar FE := FE + {@AcumuladoUnidadesSoma}
This creates a shared variable called FE which then keeps adding x to FE (The problem is here)
Then on the main report I just call the shared variable with
shared numbervar FE
What am I missing so that the value is just presented uniquely for each employee instead of adding up constantly?
Upvotes: 0
Views: 329
Reputation: 688
You need another formula field within the main report, which resets the shared variable:
shared numbervar FE := 0
It should be placed just before the subreport. In earlier versions it had to be in a different section than the subreport - I'm not sure if that's still needed, so best you create a new section just above the section with the subreport (on the same level) and place the reset formula there.
Upvotes: 1