Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Expression in report row

Author  Topic 

jamie_pattison
Yak Posting Veteran

65 Posts

Posted - 2012-08-15 : 14:26:14
I have an expression (iif(field!MyValue.Value = "Hello", True, False) in a row that displays the row based on another field's value - this works great.

Is there anyway i could add another few conditions in this expression to do something else if the value is not Hello and to take appropriate action?

Thanks

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-08-15 : 14:29:54
You can nest IIF's for example, like this:
IIF(
field!MyValue.Value = "Hello",
"Well, hello there!",
IIF(
field!MyValue.Value = "Goodbye",
"I guess this is good bye",
"What did you say?"
)
)
Go to Top of Page

jamie_pattison
Yak Posting Veteran

65 Posts

Posted - 2012-08-15 : 14:57:31
Thanks. I tried to go one step further and thought to add my code to the reports Code region, so i can use one method in all rows. I cant quite get this right. Assuming i want to show different textboxes if the text in the row equals a day.

Public Shared Function OptionOneTextboxConfig(Text as String) As Boolean
If Text = "Monday" Then

OptionOneTextboxConfig = True

Else

OptionOneTextboxConfig = False

End If

End Function


Public Shared Function OptionTwoTextboxConfig(Text as String) As Boolean

If Text = "Tuesday" Then

OptionTwoTextboxConfig = True

Else
OptionTwoTextboxConfig = False

End If

End Function

This is fine but how would i then add both functions as an expression i tried =Code.OptionOneTextboxConfig(Fields!Texbox1.value, true,false) =Code.OptionTwoTextboxConfig(Fields!Texbox1.value, true,false) but didnt work?

Thanks again
Go to Top of Page
   

- Advertisement -