4 replies

Last post Sep 25, 2017 05:28 AM by Jean Sun

• Abhishek ksh...

Member

165 Points

149 Posts

If statement in RDLC.#Error

Sep 23, 2017 12:58 PM|Abhishek kshatriya|LINK

Hi ,

I am using below formula in a textbox in RDLC with IIF.

=iif(Fields!Qty_3.Value="",0, 1)

Getting Perfect out put=0

but when i a trying the actual requirment i am getting #Error.

=iif(Fields!Qty_3.Value="",0, Fields!Qty_3.Value * Fields!Price_3.Value)

Geting #Error

Thanks ....

"Mark It As Answer If This POST Helps You"
___________________

Abhishek kshatriya
• mgebhard

All-Star

41681 Points

17470 Posts

Re: If statement in RDLC.#Error

From a mathematical standpoint you don't need the IIF since zero times anything is zero.

• Abhishek ksh...

Member

165 Points

149 Posts

Re: If statement in RDLC.#Error

Sep 23, 2017 02:05 PM|Abhishek kshatriya|LINK

then can you please suggest what i should use as IF is not available in RDLC.

"Mark It As Answer If This POST Helps You"
___________________

Abhishek kshatriya
• mgebhard

All-Star

41681 Points

17470 Posts

Re: If statement in RDLC.#Error

Abhishek kshatriya

then can you please suggest what i should use as IF is not available in RDLC.

Huh? Where are you getting IF?

Rather than returning an empty string return 0 in your query.

Basic math says anything multiplied by zero is zero.  There is no need for IIF or IF.  For example...

`0 * 1234 = 0`

Perhaps the issue is the values are not numeric? If that is the case then fix your query to return numbers.  Default to zero or null depending on what you doing.

https://docs.microsoft.com/en-us/sql/reporting-services/report-design/operators-in-expressions-report-builder-and-ssrs

• Jean Sun

Contributor

6450 Points

2525 Posts

Re: If statement in RDLC.#Error

Sep 25, 2017 05:28 AM|Jean Sun|LINK

Hi Abhishek,

Abhishek kshatriya

=iif(Fields!Qty_3.Value="",0, Fields!Qty_3.Value * Fields!Price_3.Value)

Your IIF statement looks correct, I agree with mgebhard's opinion that the problem could be caused by that the type of Fields!Qty_3.Value and Fields!Price_3.Value are not numbers.

You can try use a value directly to check if this is related to numeric issue.

`=iif(Fields!Qty_3.Value="",0 , 1)`

Best Regards,

Jean

MSDN Community Support