'Changing text to show radio buttons and checkboxes but some rows show #Error

I have a form which users are filling out and I don't have much control over the format that the data is in so it all appears in a single table with an ID and a Value column.

In the form there are checkboxes and radio buttons so some of the values are "True", "False", or the radio button ID from the form.

On my report I'm then trying to use an expression to turn the text back into a checkbox or radio button. I have all of the elements working individually but some other part of the data always returns #Error which I assumed was because it didn't fit into my expression.

I've now combined the expression into one which is below and I still get #Error on some of the fields. The result at the moment is that the checkboxes are shown and numerical values are shown but anything else whether it's just plain text or the radio buttons doesn't show.

=IIF(Fields!value.Value = "Tested", Chrw(9673) & "Tested " & Chrw(9675) & " Failed " & Chrw(9675) & " N/A", IIF(Fields!value.Value = "Failed", Chrw(9675) & "Tested " & Chrw(9673) & " Failed " & Chrw(9675) & " N/A", IIF(Fields!value.Value = "N/A", Chrw(9675) & "Tested " & Chrw(9675) & " Failed " & Chrw(9673) & " N/A", IIF(Fields!type.Value = "checkbox", IIF(Fields!value.Value = True, ChrW(&H2611), ChrW(&H2610)), Fields!value.Value))))

I think it may be because I end up with different text fonts and formats required on the same textbox but I'm not sure how to establish that for certain and then also come up with a solution.

The screenshot below is my output with the top block of #Error's being ones that should show as radio buttons and the 2 on their own further down are just plain text.

SSRS Output



Solution 1:[1]

In your final IIF you are testing Fields!value.Value against True but it would appear that you value field is text so that might not give expected results.

try changing the final

IIF(Fields!value.Value = True, ChrW(&H2611), ChrW(&H2610)), Fields!value.Value)

to

IIF(Fields!value.Value = "True", ChrW(&H2611), ChrW(&H2610)), Fields!value.Value)

If this does not help, then can you edit your question and show some sample data that is in your value and type fields, then show what you are getting now and what you expect to see. At the moment it's difficult to understand which values are working and which are not.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alan Schofield