Link to home
Start Free TrialLog in
Avatar of zachvaldez
zachvaldezFlag for United States of America

asked on

SSRS parameters, tablix filter question

In the tablix of the report , I set the filter to the following

I created 3 parameters
@begindate,@enddate, and @Stagenumber.


I get difficulty when adding the @stagenumber  parameter, which I set to Boolean, allow null. how to handle it. Without this paramener
in picture, all is fine.

The behavior I'd  like to happen is that

if @stagenumber is false, then the value of the field StageNumber will be 0
If the@stagenumber is set to true then, the value of field number > 0



What will be the syntax to get this right?
Avatar of Nico Bontenbal
Nico Bontenbal
Flag of Netherlands image

For the expression of the Filter use the Fx button to actually use an expression there. Use this expression:
=iif( Parameters!stagenumber.Value is nothing, True, iif(Parameters!stagenumber.Value, Fields!StageNumber.Value > 0, Fields!StageNumber.Value = 0))

Open in new window

This expression returns true when the parameter is null. When the parameter is true it returns true when stagenumber >0. When the parameter is false it returns true when stagenumber is 0.
As the type of the filter use Boolean. As Operator use =. And enter True for the Value.
This worked in my test.
Avatar of zachvaldez

ASKER

I removed the allow null option because I want user to select Yes which has 'True' value or
No which has 'False' value.

I haven't run your solution yet  but I will ... but here's what I did but results on either are showing same which is not right..
 So in the tablix formula I added...
=iif(Parameters!stagenumber.Value=True,Fields!Stageseq.Value > 1,Fiels!Stageseq.Value= 0)
BTW , I updated all Null values in Stageseq field  to  0.

just an opinion before I run your query.
BTW in the "stagenumber" Parameters
I set it as

Label                 Value
Yes                       True
No                         False

BTW it is returning same number of records on either Yes or no
Also how would I defined my @begindate,@enddate parameters.

currently both are set as date/time

In the tablix formula for these dates, how would I define and format it?
Strange. Your formula seems OK. Apart from the fieldname which is 'Stageseq' and not 'StageNumber' as in your question. But I assume that is an error in your question, not in the formula.
I've attached my sample report. For this example to work you need to change the Data Source of the report to a datasource that points to your SQL Server. No special tables are needed on your SQL server.
When you have this example running (or even if you don't). You can check what the differences are between my solution and your solution.
I've set the filter on the tablix of the report, like you described in your question.

I've also updated the parameter so it doesn't allow nulls, and shows Yes and No as the labels. The formula is now this:
=iif(Parameters!Stagenumber.Value, Fields!StageNumber.Value > 0, Fields!StageNumber.Value = 0)

Open in new window

StageNumber.rdl
Sorry. I only saw your last comment after I posted my answer. Let's concentrate on the StageNumber first. In your original question you said "Without this parameter
in picture, all is fine." So I assumed the StageNumber parameter was the only parameter causing the problem.
I used the latest suggestion and both choices Yes or No are returning same number of records.
I expect No to be 5  returns..
The values are true and False not 1 and 0 for Labels Yes and No
ASKER CERTIFIED SOLUTION
Avatar of Nico Bontenbal
Nico Bontenbal
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, I created another column 'test'and plug in the formula
=iif(Parameters!Stagenumber.Value, Fields!StageNumber.Value > 0, Fields!StageNumber.Value = 0)

and run it.  I tried to select 'Yes' in the dropdown  and  the test column displayed 'True' in all rows.
but when I change it to No, the test column displayed all False with same data as what is displayed as True
Did you try the expression:
=iif(Parameters!Stagenumber.Value, "Yes", "No")

Open in new window

In the extra column? If that works we are sure there is nothing wrong with the parameter. Also try these two expressions in the extra column:
=Fields!StageNumber.Value > 0
=Fields!StageNumber.Value = 0

Open in new window

I suppose the StageNumber is also in the matrix so you should be able to see if these expression return the right result.
My guess is that the StageNumber field is not a numeric field, but a text field that contains a number.
Do you need help on this?
Sorry for late reply. I was on vacation. I decided to use dataset rather than filter. Thanks
No problem. But I suppose you should close this question now.
thanks
thanks!
thanks