Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use multiple conditions (With AND) in IIF expressions in ssrs

I just want to hide rows in SSRS report having Zero Quantity.. There are following multiple Quantity Columns like Opening Stock , Gross Dispatched,Transfer Out, Qty Sold, Stock Adjustment and Closing Stock etc.. I am doing this task by using following expression.

    =IIF(Fields!OpeningStock.Value=0 AND Fields!GrossDispatched.Value=0 AND 
Fields!TransferOutToMW.Value=0 AND Fields!TransferOutToDW.Value=0 AND 
Fields!TransferOutToOW.Value=0 AND Fields!NetDispatched.Value=0 AND Fields!QtySold.Value=0 
AND Fields!StockAdjustment.Value=0 AND Fields!ClosingStock.Value=0,True,False)

But by using this expression in row visibility, report hides all the rows except Totals Row. Even though report should show rows having Quantities of above mentioned columns. Total values are shown correct.

Note: I set this row visibility expression on Detail Row.

Without using expression result is as following.

For the first 2 rows all the quantities are 0 (ZERO), i want to hide these 2 rows.

enter image description here

How can i fix this problem or which expression must i use to get required results?

Thanks in Advance for help.

like image 687
almond eyes Avatar asked Apr 01 '14 12:04

almond eyes


People also ask

What is an IF statement in SSRs?

It’s a decision function that may be invoked via expressions. The keyword for an If statement in SSRS is IIF. SSRS interprets expressions to set property values and constructs expressions using simple constants, parameters, dataset fields, functions, and operators.

How to use multiple and and multiple or in IIF expression?

Thanks for any kind of help! In SSRS, to can use Multiple AND or Multiple OR in IIF expression, you just need to enclose each condition with parenthesis () as the following: In your case, the Multiple OR condition in IIF expression should be

Is it possible to use IIF statements in SSRs?

However, you can clearly see that the nesting of iif statements, especially if you have a large number of values, could quickly get very complicated and difficult to follow. Most folks who work with T-SQL would say, let us just use a Case statement. While that could be used in the dataset T-SQL query, it is not available in SSRS.

What are the most common logical functions in SSRs?

First, the iif function is likely the most common logical function as it is synonymous with similar functions in many programming languages. However, it does not contain an elseif element, and thus nesting is required if multiple branches and outcomes are required. To address the nested iif functions, SSRS also provides a switch function.


1 Answers

Could you try this out?

=IIF((Fields!OpeningStock.Value=0) AND (Fields!GrossDispatched.Value=0) AND 
(Fields!TransferOutToMW.Value=0) AND (Fields!TransferOutToDW.Value=0) AND 
(Fields!TransferOutToOW.Value=0) AND (Fields!NetDispatched.Value=0) AND (Fields!QtySold.Value=0) 
AND (Fields!StockAdjustment.Value=0) AND (Fields!ClosingStock.Value=0),True,False)

Note: Setting Hidden to False will make the row visible

like image 118
PeterRing Avatar answered Oct 24 '22 06:10

PeterRing