I have small expression on value fields in SSRS report. Source data type of value is NVARCHAR. It has some numeric value as well which I want to convert into currency and else should be display as it is.
=IIF(Fields!Description.Value LIKE "Blank*","",
IIF(IsNumeric(Fields!Value.Value)=True,FormatCurrency(Fields!Value.Value,0),Fields!Value.Value)
)
Report displays the numeric values in currency format but where it has string values it showing #Error.
I don't think you can use LIKE in an SSRS expression.. you need to use something like this:
=IIF(InStr(Fields!Description.Value,"Blank")>0,"",
IIF(IsNumeric(Fields!Value.Value)=True,FormatCurrency(Fields!Value.Value,0),Fields!Value.Value)
)
Related
I have question in SSRS report builder below is the data in column as
Site Information :
1,
2,
Not applicable.
So how to Calculate sum and percentage by excluding Not applicable text value .
Please help me
You can use the VAL() Function. This simply converts a string into a value is the string contains only data that can be viewed as a number.
So your expression would just be something like
=SUM(VAL(Fields!myTextField.Value))
I have one expression in my SSRS report which use to display currency data in the report. When there is no data NULL in the particular row it should display $0. However, it is displaying #Error.
=IIF(Fields!Value.Value="Nothing","$0",FormatCurrency(Fields!Value.Value,0))
I tried with IsNothing function as well but getting same result.
Take the quotes off Nothing..
=IIF(Fields!Value.Value=Nothing,"$0",FormatCurrency(Fields!Value.Value,0))
I have a query that is using this convert function that correctly displays the data when I preview it in the SSRS Dataset:
CONVERT(varchar(255), HashedFileNum, 1) AS HashedFileNum
returns values like
0x7BB9D2F1A8A1B39832B95B932DD73A31
However when I try to add that field to my report I get #ERROR in the field instead of the value.
Any suggestions on getting the value to show in my report?
Try converting to nvarchar instead of varchar; I've had a similar issues in the past.
I have generated one ssrs report
now i have two fields having values
1st field value is =Fields!FirstNO.Value
2nd field value is =Fields!SecondNO.Value
now i have one field average and i need to write expression like
average = (Fields!FirstNO.Value+Fields!SecondNO.Value) / (Fields!SecondNO.Value)
how can i write above in expression?? directly as i shown or any other syntax is there please help?
Are you sure these fields are numeric? Maybe try convert to numeric, like =cint(Fields!FirstNO.Value)
My datasource is XML (sharepoint list). I basically want to show the date formatted if the value in the field is a date and if not then show "NA". For some reason, even when the data is a a string it is still trying to convert it to a date somewhere. Here is my code..
=IIF
(
ISDATE(replace(First(Fields!ows_Manufacturing_Date.Value, "DataSet1"),"datetime;#","")),
formatdatetime(replace(First(Fields!ows_Manufacturing_Date.Value, "DataSet1"),"datetime;#",""),2),
replace(First(Fields!ows_Manufacturing_Date.Value, "DataSet1"),"string;#","")
)
The problem is that the IIF statement in SSRS doesn't short circuit, it always evaluates both conditions, so even if the field is not a date, it still tries to do the formatdatetime function.
(See this: SSRS iif function question)
Instead of the IIF function, try using the SWITCH function instead:
=SWITCH(First(Fields!ows_Manufacturing_Date.Value, "DataSet1")="string;#NA",
"NA",
First(Fields!ows_Manufacturing_Date.Value, "DataSet1")<>"string;#NA",
formatdatetime(replace(First(Fields!ows_Manufacturing_Date.Value, "DataSet1"),"datetime;#",""),2))