SSRS IIF Multiple expression not working - reporting-services

Please see pic
For some reason my expression is not working and I cannot figure out why...
What I'm trying to do is check the UseByDate if it's blank set time to blank AND if pickeddatetime is blank (time field) also set to blank if not blank use pickeddatetime. However my expression doesn't seem to be working correctly for some reason?
=IIF(Fields!UseByDate.Value is nothing, nothing, IIF(Fields!PickedDateTime is nothing, nothing, FORMAT(System.TimeZone.CurrentTimeZone.ToLocalTime(Fields!PickedDateTime.Value), "HH:mm")))
I've checked the pickeddatetime value and it is definitely null for this row.

Replace Fields!PickedDateTime with Fields!PickedDateTime.Value

I think the way the expression is written isn't checking for nothing correctly. Try:
=IIF(IsNothing(Fields!UseByDate.Value)=True, nothing, IIF(IsNothing(Fields!PickedDateTime)=True, nothing, FORMAT(System.TimeZone.CurrentTimeZone.ToLocalTime(Fields!PickedDateTime.Value), "HH:mm")))

Related

DSUM with no results show as blanks

I am experiencing a bit of a problem.
My textboxes populate based on DSUMS, but if someone doesn't take a payment they are not in the table so the textbox shows blank. However I was it to at least have a zero in it.
I have tried changing the default value but still shows as a blank
Help
A simple Nz(DSUM(stuff), 0) replaces all Null values with 0

Replace Zero with Blank in SSRS

Is it possible to replace 0 with blank in ssrs matrix. The expression
=IIF(IsNothing(Count(Fields!referralNo.Value)),0,Count(Fields!referralNo.Value))
is same as
=Count(Fields!referralNo.Value).
When I try =IIF(IsNothing(Count(Fields!referralNo.Value)),'',Count(Fields!referralNo.Value)) I'm getting error. Can somebody pls help!
you could use text box properties and set show zero as: option to blank.
I use this expression for percentage data - I like code better than format, but they both work ;)
=iif(Fields!STUFF_PCT.Value>0,Fields!STUFF_PCT.Value,"")
Use this format #,##0.00;-#,##0.00;""

how to solve SSRS Formatting issue?

Currently the data in field is coming like this 9646.88 and my requirement is
Remove decimal places and add comma for thousands e.g. 9,646
=IIF((RTRIM(Fields!COMPANY_NAME.Value))="VACANT","",Fields!BASE_RENT_PM.Value)
Please help, I am a newbie in SSRS.
Go to Properties pane when you select the textbox.
Then put this on Format property
#,0;(#,0)
Using Common Functions such as Text and Conversion functions shown in Expression window will give you the desired result.
For e.g,
Format(Int(9646.88), "#,###") // try "#,##0" which returns 0 if less than 1
where Int(9646.88) returns the integer portion of the number 9646 and Format(9646,"#,###") returns a string formatted according to instructions contained in a format String expression "#,###" which is a thousand seperator. Thus, it will give you "9,646".
So, in your case, try this,
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT", "", Format(Int(Fields!BASE_RENT_PM.Value),"#,###"))
Note:
Format(9646.88, "#,###") will return a rounded result 9,647 and
Format("VACANT", "#,###") returns just "#,###",
none of which may not be your desired result.
Have your Tried this?
=FORMAT(IIF((RTRIM(Fields!COMPANY_NAME.Value))="VACANT","",Fields!BASE_RENT_PM.Value),"#,###")
Should solve your issue.
Kind Regards
To add comma for thousands, you need to change your expression.
If you need output as 9,646 then try below.
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT","",Format(Convert.ToInt32(Int(Fields!BASE_RENT_PM.Value),"#,0;(#,0)")))
OR
=IIF(RTRIM(Fields!COMPANY_NAME.Value)="VACANT","",Format(CInt(Int(Fields!BASE_RENT_PM.Value),"#,0;(#,0)")))
Updated Answer:
As you want to handle null values as well I would suggest below way to achieve your goal.
Set Textbox visibility with below expression.
=IIF(ISNOTHING(Fields!BA‌​‌​‌​SE_RENT_PM.Value),True,False)
So if null value is there then it will show blank in the ssrs report.

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

Cell displays #Error when I expect an INT in SSRS

I'm having a problem when trying to display a 0 when there is an occurrence of a special which I have listed in my data source
The normal sum computes fine and displays in the cells without the special day, but the cells which have a special day displays an #error
=iif(Fields!SpecialDay,
0,
Fields!NormalSum)
and then I have tried variations to get the integer, such as
CInt("0")
Fields!NormalSum - Fields!NormalSum
but I still get an #Error in the cells for which I wish to display a 0.
Any thoughts on this particular problem?
Many thanks
Ending up using
=iif(Fields!SpecialDay,
nothing,
Fields!NormalSum)
Better to do so in VB.
The problem is you are referring to the object Fields!NormalSum
You need to refer to its "Value" property Fields!NormalSum.Value