How to make #Error to Empty in RDLC Report Expressions? - rdlc

My Report had AmountColumn(Fields!Amount) & Amount%Column. I am calculating Grand Total for both the columns using expressions.
I am getting #Error in GrandTotal of Amount%Column when AmountColumn is Empty.
How to make GrandTotal of Amount%Column as Empty instead of #Error.
My Expression Showing #Error:
=FormatNumber(Sum(CDec(Fields!Amount.Value))/Sum(CDec(Fields!Amount.Value),"Tablix2")*100,4)

Try
=IIF(IsNothing(Fields!Amount.Value),"NA",FormatNumber(Sum(CDec(Fields!Amount.Value))/Sum(CDec(Fields!Amount.Value),"Tablix2")*100,4))

Related

SSRS How convert #Error to return "Prior"

I have date data coming in to a dataset in the format of yyyyMM. In my Tablix, I have the following exression:
=Format(DateValue(MonthName(Right(Fields!IncurredyyyyMM.Value, 2))+","+
Left(Fields!IncurredyyyyMM.Value,4)), "Y")
This converts IncurredyyyyMM correctly. However, in some instances the dates come is as 0000-00. This is causing my expression to return #Error. I would like the instances where 0000-00 populates to come back as "Prior" in my Tablix.
How can I update my expression to return "Prior" whenever #Error results from the expression?

SQL Report Returning Nulls

I have written a report and im having a little bother with NULL values.
In my report i had a WHERE clause:
WHERE Cust.Ref LIKE ?
This clause caused issues with another section of my report (Nominal Codes). When i filtered on a nominal code, it returned 0 results where it should have returned 34 results.
I removed the WHERE clause and it worked fine...Great i have found the issue.
I changed my WHERE clause to:
WHERE (Cust.Ref LIKE ? OR Cust.Ref IS NULL)
This fixed the nomincal code issue but now when i filter by a customer reference it also brings back all NULL values.
Can someone please advise?
Thanks.
You can turn the where clause around a bit to check for a null placeholder value.
WHERE (? IS NULL OR Cust.Ref LIKE ?)

How to handle error "#Error" when using CCur() in MS Access

I am trying to use Access to convert a table with a column of string into Currency if the string expression is valid.
My Input
line data
--------------
8 Date
9 66.00
My query
SELECT line, CCur([data]) AS data
FROM Input;
My query output is
line data
--------------
8 #Error
9 $66.00
My ideal output is
line data
--------------
9 $66.00
I would like filter our the #Error in query. However, when I use the criteria field (i.e. >0), it prompts me Data type mismatch.
I also tried to use IsError() or IsNumeric() with IIF to catch the error. However, it still shows the #Error in the output.
I also found in post that Nz() could help. Still, the same #Error in my case.
Is there any function or tool to handle this error?
Filter on IsNumeric:
SELECT line, CCur([data]) AS data
FROM Input
WHERE IsNumeric([data])
Note that this will still throw errors internally, it just doesn't return them. This can be a problem in certain situations (e.g. when using VBA to open a recordset). We can avoid that using IIF:
SELECT line, CCur(Iif(IsNumeric([data]), [data], 0)) AS data
FROM Input
WHERE IsNumeric([data])

RDLC Expression shows #Error

My writing an Expression RDLC SSRS
((Sum(Fields!MockObtMarks.Value))/(Sum(Fields!MockTotalMarks.Value))) * 100
Now this expression shows #Error when the sum (0/0) *100
i have used if and switch case still not working
You should really show the expressions you tried in your question, but this should do:
=IIF( (Sum(Fields!MockTotalMarks.Value)) = 0, 0, ((Sum(Fields!MockObtMarks.Value))/(Sum(Fields!MockTotalMarks.Value))) * 100 )

#Error in IIF formula

I am using report builder and I have created an IIF statement on a calculated field I have created (called Tolerance)
The field of "Tolerance" is returning a difference in time between two other fields in the format of 00:00:00.
My IIF statement is as follows:
=IIF(Fields!Tolerance.Value < = "-00:10:00", "Passed","Failed")
This is running OK in the report but the results are all #Error.
You have an space between < and =. This space is not allowed, as these are not two different operators, but a single <= operator:
=IIF(Fields!Tolerance.Value <= "-00:10:00", "Passed","Failed")
Is your field Tolerance.Value a number?
Value "-00:10:00" is a string.
Try
=IIF(CSTR(Fields!Tolerance.Value) <= "-00:10:00", "Passed","Failed")
It would be helpful if you would provide samples of your Tolerance.Value values. This solution might only fix the #Error in your resulting report, but not be what you want in case Tolerance.Value should be formatted to similar format with your "-00:10:00" value.