0
votes

I'm new at using reporting tool and i can't figure out how to show/hide image in report. This is my code. Been playing with it for a while and I can't get right solution. Suppose i'm gonna hide it.

Microsoft.VisualBasic.Interaction.IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = "1", True, False)
2

2 Answers

1
votes

As you already know you have to set Hidden property of your Image using this syntax:

=IIf(<condition for hiding an object>, True, False)

If your Image is inside a Table detail you can use this syntax:

=IIf(Fields![ES_EXCUSETYPE].Value = "1", True, False)

If your Image is outside a Table detail you could use this syntax:

=IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = "1", True, False)

That syntax only verify if the first record in Dataset meets the condition; so it is usually better to use a ReportParameter instead.

0
votes

UPDATE: The error was only the data type, i forgot that i set the value to INT and only converting it to string at the back end so i change "1" ----> 1 and fortunately it work :)

Microsoft.VisualBasic.Interaction.IIf(First(Fields![ES_EXCUSETYPE].Value, "DataSet1") = 1, True, False)