hey there, relatively new new SRS, but lots of Crystal background. I'm having
a bit of difficulty with parameters/filters. I have a run-time parameter
setup which then filters the report. The parameters themselves work fine,
but I want them to be optional. In other words, I want a parameter option
that shows me all the records. I would think an expression would work, but
I can't seem to get the syntax to work quite right. Is there an expression
or another setup?My first suggestion is to stay away from filters unless you absolutely have
to use them. With a filter all the data is brought down from the database
and then filtered by RS. What is much better (much higher performance) is to
apply it with the query.
First, how to do an all. Use a union query (or if you have hard coded the
parameters just add this).
select somefield as value, another field as label from a table union
select 'All' as value, 'All' as label
next your query for the data.
Select blah, blahblah from mytable where anotherfield = @.MyParam or @.MyParam
= 'All'
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Shawn" <crmpro@.gmail.com> wrote in message
news:12107632558864480156250@.news.west.cox.net...
> hey there, relatively new new SRS, but lots of Crystal background. I'm
> having a bit of difficulty with parameters/filters. I have a run-time
> parameter setup which then filters the report. The parameters themselves
> work fine, but I want them to be optional. In other words, I want a
> parameter option that shows me all the records. I would think an
> expression would work, but I can't seem to get the syntax to work quite
> right. Is there an expression or another setup?
>
Showing posts with label srs. Show all posts
Showing posts with label srs. Show all posts
Monday, March 12, 2012
Parameters option for "All"
Labels:
background,
bit,
crystal,
database,
difficulty,
filters,
lots,
microsoft,
mysql,
oracle,
parameters,
relatively,
run-time,
server,
sql,
srs
Wednesday, March 7, 2012
Parameters Dropdown, How to add a "all" feature
Hi everyone.
I have done SRS for 3 years and have never run across this issue until
today.
I have a simple report.
It takes a parameter called "SalesPerson" (select fullname from
sales_contact)
I use this parameter to get my data back.
ie (select * from sales where salescontact = @.SalesPerson)
That works great.
My boss wants me to add an "All Sales People" item as the 1st in the
dropdown list.
I'm not sure the best way to implement this.
I don't want to make a duplicate report as that is wasteful.
Thanks, JonHi Jon,
Use UNION in your "SalesPerson" dataset.
SELECT 'All Sales People' as fullname , 0 as sort
UNION
SELECT fullname ,1 as sort
FROM sales_contact
ORDER by sort
The sort allows you to bring the 'All Sales People' on top of the list
In your main SQL you need to do a case statement
select * from sales where salescontact = CASE WHEN @.SalesPerson = 'All
Sales People' THEN salescontact ELSE @.SalesPerson END )
hope this helps
On Jan 26, 8:41 am, jonknutsonh...@.yahoo.com wrote:
> Hi everyone.
> I have done SRS for 3 years and have never run across this issue until
> today.
> I have a simple report.
> It takes a parameter called "SalesPerson" (select fullname from
> sales_contact)
> I use this parameter to get my data back.
> ie (select * from sales where salescontact = @.SalesPerson)
> That works great.
> My boss wants me to add an "All Sales People" item as the 1st in the
> dropdown list.
> I'm not sure the best way to implement this.
> I don't want to make a duplicate report as that is wasteful.
> Thanks, Jon|||Are you using 2005? then you can use multi select, so atleast not "All sales
person", you get a word "ALL" on top of the list
so I think that should be ok with you for the selection.. accordingly you
need to change by just including "IN (@.salesperson) in your sql query.
Amarnath
"jonknutsonhome@.yahoo.com" wrote:
> Hi everyone.
> I have done SRS for 3 years and have never run across this issue until
> today.
> I have a simple report.
> It takes a parameter called "SalesPerson" (select fullname from
> sales_contact)
> I use this parameter to get my data back.
> ie (select * from sales where salescontact = @.SalesPerson)
> That works great.
> My boss wants me to add an "All Sales People" item as the 1st in the
> dropdown list.
> I'm not sure the best way to implement this.
> I don't want to make a duplicate report as that is wasteful.
>
> Thanks, Jon
>
I have done SRS for 3 years and have never run across this issue until
today.
I have a simple report.
It takes a parameter called "SalesPerson" (select fullname from
sales_contact)
I use this parameter to get my data back.
ie (select * from sales where salescontact = @.SalesPerson)
That works great.
My boss wants me to add an "All Sales People" item as the 1st in the
dropdown list.
I'm not sure the best way to implement this.
I don't want to make a duplicate report as that is wasteful.
Thanks, JonHi Jon,
Use UNION in your "SalesPerson" dataset.
SELECT 'All Sales People' as fullname , 0 as sort
UNION
SELECT fullname ,1 as sort
FROM sales_contact
ORDER by sort
The sort allows you to bring the 'All Sales People' on top of the list
In your main SQL you need to do a case statement
select * from sales where salescontact = CASE WHEN @.SalesPerson = 'All
Sales People' THEN salescontact ELSE @.SalesPerson END )
hope this helps
On Jan 26, 8:41 am, jonknutsonh...@.yahoo.com wrote:
> Hi everyone.
> I have done SRS for 3 years and have never run across this issue until
> today.
> I have a simple report.
> It takes a parameter called "SalesPerson" (select fullname from
> sales_contact)
> I use this parameter to get my data back.
> ie (select * from sales where salescontact = @.SalesPerson)
> That works great.
> My boss wants me to add an "All Sales People" item as the 1st in the
> dropdown list.
> I'm not sure the best way to implement this.
> I don't want to make a duplicate report as that is wasteful.
> Thanks, Jon|||Are you using 2005? then you can use multi select, so atleast not "All sales
person", you get a word "ALL" on top of the list
so I think that should be ok with you for the selection.. accordingly you
need to change by just including "IN (@.salesperson) in your sql query.
Amarnath
"jonknutsonhome@.yahoo.com" wrote:
> Hi everyone.
> I have done SRS for 3 years and have never run across this issue until
> today.
> I have a simple report.
> It takes a parameter called "SalesPerson" (select fullname from
> sales_contact)
> I use this parameter to get my data back.
> ie (select * from sales where salescontact = @.SalesPerson)
> That works great.
> My boss wants me to add an "All Sales People" item as the 1st in the
> dropdown list.
> I'm not sure the best way to implement this.
> I don't want to make a duplicate report as that is wasteful.
>
> Thanks, Jon
>
Subscribe to:
Posts (Atom)