views:

226

answers:

2

I have a table in a report and a textbox that changes its background color based on the value(s) in the table. Right now I have the background color expression for the textbox set to:

=iif(Me.Value = ReportItems![NewValue].Value, "Yellow", "Transparent")

"NewValue" is the name of one of the columns in the table. The above works fine if the textbox value is in the very first row in the "NewValue" column, but not otherwise.

How do I fix this so it will work if the textbox value shows up in any row in the "NewValue" column?

Sorry, I'm a little new to Reporting Services and haven't seen any functions for table controls.

A: 

Instead of ReportItems![NewValue].Value, you can also use ReportItems("NewValue").Value, by the way

Novi
oops... i was just actually gonna write comment :)
Novi
A: 

I finally got this working yesterday thanks to this blog post:

http://mpasharp.spaces.live.com/blog/cns!5BA71A558863C810!191.entry?sa=340192646

I basically did what he did in the post, modified slightly for my report. I also added a function for getting the row index of the value I was looking for (variables are a little different in mine).

Public Shared Function GetChangedValueIndex(txt As String) As Integer
Dim counter As Integer = 0
For Each s As String In ChangedValueList
 If s = txt Then
  Return counter
 End If

 counter += 1
Next
Return -1

End Function

The other caveat is that calling the function to add a value to the array has to occur earlier in the report than anywhere you want to check for it. The table I was working with is actually at the end of the report (and can't be moved for requirements reasons) so I made a copy of that table, moved it to the top of the report, and set it to be hidden.

Unbelieveable that there isn't an easier way to do this.

dgundersen