July 28, 2011 at 3:04 pm
I have a report that has 2 groups: Business Manager (parent) and Salesman (child). When initally running the report, the parent rows are collapsed and show the accumulated totals of the children under each parent. When a parent row is expanded to show the children, sometimes a percent amount in one of the parent columns disappears.
The pattern seems to be that when the first child row has 0's in one of two textboxes that are used in a calculation to determine the percent for that child, the parent percent gets wiped out. I use the following report code to determine the percent for each parent and child:
Public Shared Function EvalDivideByZero(ByVal Actual As Decimal, ByVal Divisor As Decimal) As Decimal
If Divisor = 0
Return 0
End If
Return (Actual / Divisor)
End Function
The expression used in the percent textbox in both the parent and child rows is as follows:
=code.EvalDivideByZero(ReportItems!textbox1.value, ReportItems.textbox2.value). The textbox number varies based on the row.
If both of the two textboxes has something other than 0 in them in the first child row, the parent row displays just fine when expanded. And when the child row with the zeroes is the 2nd thru n child row, the parent row is just fine too.
I do have another issue with the parent row losing its percent value when the parent row is collapsed. This happens when the first two child rows both have zeroes in the two textboxes used for the percent calculation.
Frustrating to say the least.....
Dave.
August 2, 2011 at 11:09 am
I found the issue and corrected it....
When the parent group was added, some of the textboxes from the child group were copied to the parent group (for value expressions). Some of these textboxes had expressions for font control that referenced the value in itself. The expressions were not changed in the parent group, so they still referenced the child group. So if a textbox value in the child group = 0, it caused the font in the parent textbox to be white (basically hide it). After changing the expressions in the parent row textboxes to reference the parent row textbox, all is well..... 😀
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply