how to use split in iif conditional expression in ssrs 2008 r2
hi,
how can i use conditional iif combined with split?
i'm trying to get values from check boxes(from sharepoint custom list), the condition is like this :
if the value is null/blank, the return value would be "-"
if the value is not blank, the return value would be the value of the check box field that already splitted from the ";#" character
as you might know, values from check box is written along with ";#" character before and after the value itself.
i tried to use this expression:
=IIF(Fields!Action__For_User_Access_.Value Is Nothing," - ",(Split(Fields!Action__For_User_Access_.Value, ";#")(1)))
the split worked just fine, but the conditional iif didn't work.
can anybody help me?
i used that expression in the calculated field.
btw, i'm using report builder content type from ssrs 2008 r2
thx in advance.
-willy-
September 28th, 2010 2:42pm
Ok this is a blinder, but can you try using Join() instead of split
=IIF(Fields!Action__For_User_Access_.Value Is Nothing," - ",Join(Fields!Action__For_User_Access_.Value, ";#"))Cheers,
Jason
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2010 2:50pm
hi Jason,
thx for the reply.
i tried to use your expression, now the iif conditional went well but the split didn't work.
in my case, the value from the check box is like this ;#Category;#
any other suggestion?
thx.
-willy
September 28th, 2010 2:56pm
Try the below
= IIF(isnothing(Fields!Action__For_User_Access_.Value) or (Fields!Action__For_User_Access_.Value="") ," - ",(Split(Fields!Action__For_User_Access_.Value, ";#")(1)))
But not sure about to which property you are trying to assign this expresion.Split function will return an array.
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2010 2:57pm
Hi Sorna,
thx for the reply.
i used your expression, now the split worked, but the conditional iif didn't work (#Error).
any other suggestion??
thx.
-willy-
September 28th, 2010 3:02pm
i managed to solved it with my friend's help.
apparently it's only a matter of bracket placing.
i miss placed the bracket
it should be like this :
=IIF(Fields!Action__For_User_Access_.Value Is Nothing," - ",(Split(Fields!Action__For_User_Access_.Value, ";#")))(1)
thx for the replies.
-willy-
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2010 3:21pm
=iif( Fields!Action__For_User_Access_.Value is nothing ,"blank",Split(IIF(ISNOTHING(Fields!Action__For_User_Access_.Value ) ,",",Fields!Action__For_User_Access_.Value ), ",")(1))
The above code should work.
The issue is the parsing engine is trying to evaluate the FALSE part also even the value it NULL.In the above code , inside the split function one another IIF is introduced to put some dummy value "," to make sure the split function returns some value at
that index speficied.
September 28th, 2010 3:55pm