i found the answer. i used the SWITCH operator not the IIF
trying to set the colour depending on multiples using RDLC expression
Hi Guru's
I am trying to set the colour depending on multiples.
In RDLC Report Builder -> placeholder Properties -> Font -> Colour Fx I tried to add an expression like this but it does not load with error 'no accessable "IIFs" accepts this number of arguments.
i can get it to work for one, but not dynamically for a range. tried using OR and tried closing brackets after each IIF. closing brackets loads without error but just does not work.
tried directly on field value, and tried passing a true / false from code in BC (first example)
any ideas?
=IIF(Fields!blue.Value=TRUE,"Blue","Black",IIF(Fields!red.Value=TRUE,"Red","Black",IIF(Fields!yellow.Value=TRUE,"Yellow","Black",IIF(Fields!green.Value=TRUE,"Green","Black"))))
this loads but I just get Black regardless
=IIF(Fields!Substrate.Value = "RYE","Blue","Black"
OR IIF(Fields!Substrate.Value = "Millet" OR "SCMILLET","Red","Black" OR IIF(Fields!Substrate.Value = "SORGHUM","Yellow","Black" OR IIF(Fields!Substrate.Value = "RYE MIX","Green","Black"))))
this also loads but i just get black
=IIF(Fields!Substrate.Value = "RYE","Blue","Black"
) OR IIF(Fields!Substrate.Value = "Millet" OR "SCMILLET","Red","Black") OR IIF(Fields!Substrate.Value = "SORGHUM","Yellow","Black") OR IIF(Fields!Substrate.Value = "RYE MIX","Green","Black")
SQL Server Reporting Services
2 answers
Sort by: Most helpful
-
-
Anonymous
2023-06-26T06:51:23.94+00:00 Hi @Noel Donohoe
I'm glad your problem was solved.
As you found out, the decision function has the IIF function and the Switch function. The If function returns one of two values based on the evaluation of an expression (True or False). The Switch function is useful if you want to test three or more conditions. You can check out this link for examples of their usage: https://learn.microsoft.com/en-us/sql/reporting-services/report-design/expression-examples-report-builder-and-ssrs?view=sql-server-ver16#DecisionFunctions.
Best regards,
Aniya