Sunday, March 11, 2012

Dynamic footer visibility

I have two DataSet and two tables in a report. Almost identical reports (top 5). Both DataSet have a Boolean indicator and I am to append an asterisk to a column in the detail rows if indicator is true. If an asterisk appears, I am to display the footer, that has a comment in it explaining the asterisk.

Public Class AsteriskFootNote

'

' To be used on the Visibility.Hidden attribute

'

Dim _FooterVisiblity As Boolean = True

Public ReadOnly Property FooterVisibility() As Boolean

Get

Return _FooterVisibility

End Get

End Property

'

Function AsteriskIndicator(ByVal strInd As String) As String

If (strInd.ToLower = "true") Then

_FooterVisibility = False

Return "*"

End If

Return ""

End Function

'

End Class

I have instantiated two classes Dollars and Hours. In the detail, call the

=Fields!Descr.Value & Code.Dollar.AsteriskIndicator( Fields!MultiInd.Value )

In the footer visibility, I assign hidden:

=Code.Dollar.FooterVisibility

But it does not work. The tables act as if they assign the Hidden value, then processes the detail rows.

I belieive the problem is that RS processes the outer bands/section of the table prior to the inner bands. This means that the footer of a table is actually processed prior to the detail section. Two possibilties are

Use an invisible table at the beginning of a report to call the asterikindicator function.

or

Instead of embedded code you should be able to construct an expression like =iif(sum(iif(fields!boolfield=True,1,0)),False,True) and put it on the visibility property of the footer row.

|||

phuhn wrote:

But it does not work. The tables act as if they assign the Hidden value, then processes the detail rows.

I'm not sure I understand this last bit. What actually happens?

Have you tested that the function calls actually work?

Try placing the expressions inside a textbox and see if the value returned is as expected.

It's probably just a typo but you say that you instatiated a class calld Dollars, yet your expression referes to Dollar.

|||

Yes, I created a testing report and played around with TextBox's and it does work.

My temporary solution was to remove the Footer and replace the footer with a TextBox and it does work.

Phil

No comments:

Post a Comment