Reputation: 3676
I am new to SSRS. What I thought should be very simple took me 1 day and I am not able to fix it. All I need is the following
Select * from table1 where len(username) <= 6
Select * from table1 where len(username) >= 7
I want to display a drop menu with two options Short Username and Long Username. When a username click the short username the first query result is showed and when the user click Long username the second query result is showed.
What I did so far is I added a parameter list with two values i.e Short parameter list = 6 and Long parameter list = 7. I then added two filters. In the first the expression= len(NameColumn.value) operator= <= value = @parameter. In the second the expression= len(NameColumn.value) operator= >= value = @parameter. Can you please what can I do to achieve it.
Upvotes: 2
Views: 4057
Reputation: 10860
You can do a similar FILTER in the dataset that @energ1ser mentioned.
You would have a Parameter where the user selects either Long or Short. You might use different values for it.
For the expression, you would use:
=IIF( (Parameters!YourParameter.Value = "Short" and LEN(FIELDS!USERNAME.VALUE) <= 6)
OR (Parameters!YourParameter.Value = "Long" and LEN(FIELDS!USERNAME.VALUE) >= 7), 1, 0)
For the type, use Integer, and Operator = and Value 1.
This expression calculates each row as 0 or 1 and then filters it for the 1's.
To display ALL records, add another OR for when All is selected for the Parameter.
=IIF( (Parameters!YourParameter.Value = "Short" and LEN(FIELDS!USERNAME.VALUE) <= 6)
OR (Parameters!YourParameter.Value = "Long" and LEN(FIELDS!USERNAME.VALUE) >= 7)
OR (Parameters!YourParameter.Value = "All"), 1, 0)
Upvotes: 2
Reputation: 2873
I think it may work better to do the filtering in the query rather then use the SSRS filters. Try this query.
select * from table1 where (@Parameter = 0 and len(username) <= 6) or (@Parameter = 1 and len(username) >= 7)
And your parameter could be setup like this.
Upvotes: 2