Showing posts with label dataset. Show all posts
Showing posts with label dataset. Show all posts

Thursday, March 29, 2012

Concatenate list of values under a group

I have the following dataset:

State ZIP Homes Schools

WA 98007 2000 4

WA 98052 3000 5

WA 98079 2000 3

Now if I have set the group by expression on State but as display if I want to show it as “[98007, 98052, 98079]” how can I accomplish this.

My report needs to show:

State Homes Schools

[98007, 98052, 98079] 7000 12

Any help will be greatly appreciated

SPJ11, Why dont you do this in SQL itselves? You can also do this in SSRS. At the group level use,

Sum(Fields!Homes.value), Sum(Fields!Schools.value) -- these will retun the counts correctly.

I am not sure as how to concatnate the zip codes. I thought this should work

Join(Fields!Zip.Value) -- but this does not seem to work, I will see if I can come with something else...

|||

Never mind. I could make it work. Thanks to everyone who spent time on this thread

sqlsql

Sunday, March 25, 2012

Computer Hang Up when using MDX Query Builder?

hello,
I have some reports using OLAP cube as data sources. When I use mdx
query builder to create any mdx statement as dataset, my computer will hang
up and pop up a window says:
Preparing Query: The query preparation is in process, to cancel, press
CTRL+C for at least half a second.
Even if I press CTRL+C for a long time, my computer still has no
response and hang up forever. I have tried these mdx statement in my SQL
server and they work fine. So this should not be an Analysis Serverices
problem. Would you please tell me how to solve this problem?I've found that if I create a huge data set with the mdx query builder, I
have to leave my computer to it and go get a cup of coffee while it chews
through the data.
Or you could add a few filters to it before starting the query execution, to
make sure the data set it returns is too big. Adding a date filter and make
it default to the last month or date will usually decrease the amount of
data returned.
My pc is running with 2 GB RAM and not a lot of applications in the back
ground. It still uses some time to chew through a data set that finishes
quite quickly in the SQL Server management studio, so I agree with you, it's
a RS issue more than an AS issue. You just have to be carefull about your
statement while using the builer, I guess.
Kaisa M. Lindahl Lervik
"jimmy" <jimmy@.discussions.microsoft.com> wrote in message
news:7375D569-D9C8-4309-8BA6-E46C8582FE32@.microsoft.com...
> hello,
> I have some reports using OLAP cube as data sources. When I use mdx
> query builder to create any mdx statement as dataset, my computer will
> hang
> up and pop up a window says:
> Preparing Query: The query preparation is in process, to cancel, press
> CTRL+C for at least half a second.
> Even if I press CTRL+C for a long time, my computer still has no
> response and hang up forever. I have tried these mdx statement in my SQL
> server and they work fine. So this should not be an Analysis Serverices
> problem. Would you please tell me how to solve this problem?
>|||write more efficient MDX statements?
share your MDX statement when you're having performance problems?
try not to use soo many crossjoins?
-Aaron
Kaisa M. Lindahl Lervik wrote:
> I've found that if I create a huge data set with the mdx query builder, I
> have to leave my computer to it and go get a cup of coffee while it chews
> through the data.
> Or you could add a few filters to it before starting the query execution, to
> make sure the data set it returns is too big. Adding a date filter and make
> it default to the last month or date will usually decrease the amount of
> data returned.
> My pc is running with 2 GB RAM and not a lot of applications in the back
> ground. It still uses some time to chew through a data set that finishes
> quite quickly in the SQL Server management studio, so I agree with you, it's
> a RS issue more than an AS issue. You just have to be carefull about your
> statement while using the builer, I guess.
> Kaisa M. Lindahl Lervik
>
> "jimmy" <jimmy@.discussions.microsoft.com> wrote in message
> news:7375D569-D9C8-4309-8BA6-E46C8582FE32@.microsoft.com...
> > hello,
> >
> > I have some reports using OLAP cube as data sources. When I use mdx
> > query builder to create any mdx statement as dataset, my computer will
> > hang
> > up and pop up a window says:
> >
> > Preparing Query: The query preparation is in process, to cancel, press
> > CTRL+C for at least half a second.
> >
> > Even if I press CTRL+C for a long time, my computer still has no
> > response and hang up forever. I have tried these mdx statement in my SQL
> > server and they work fine. So this should not be an Analysis Serverices
> > problem. Would you please tell me how to solve this problem?
> >
> >|||Hi, Kaisa
Thanks a lot for your suggestions. I have tried a very simple mdx with a
middle size data set. e.g.
SELECT NON EMPTY { } ON COLUMNS,
{ ([Financial Period].[Fiscal].[Fiscal Year].ALLMEMBERS ) } ON ROWS FROM
[myCube]
My computer has a 1GB RAM, not so bad...This query will take about 1
second in my SQL server, however in ES it just hang up for hours and never
get back again, much more than a cup of coffee time.
I will try that on another computer to have a test and I do not think
that will happen too.
Do you think I should remove SQL server or Visual Studio and install
again?Thanks.
"Kaisa M. Lindahl Lervik" wrote:
> I've found that if I create a huge data set with the mdx query builder, I
> have to leave my computer to it and go get a cup of coffee while it chews
> through the data.
> Or you could add a few filters to it before starting the query execution, to
> make sure the data set it returns is too big. Adding a date filter and make
> it default to the last month or date will usually decrease the amount of
> data returned.
> My pc is running with 2 GB RAM and not a lot of applications in the back
> ground. It still uses some time to chew through a data set that finishes
> quite quickly in the SQL Server management studio, so I agree with you, it's
> a RS issue more than an AS issue. You just have to be carefull about your
> statement while using the builer, I guess.
> Kaisa M. Lindahl Lervik
>
> "jimmy" <jimmy@.discussions.microsoft.com> wrote in message
> news:7375D569-D9C8-4309-8BA6-E46C8582FE32@.microsoft.com...
> > hello,
> >
> > I have some reports using OLAP cube as data sources. When I use mdx
> > query builder to create any mdx statement as dataset, my computer will
> > hang
> > up and pop up a window says:
> >
> > Preparing Query: The query preparation is in process, to cancel, press
> > CTRL+C for at least half a second.
> >
> > Even if I press CTRL+C for a long time, my computer still has no
> > response and hang up forever. I have tried these mdx statement in my SQL
> > server and they work fine. So this should not be an Analysis Serverices
> > problem. Would you please tell me how to solve this problem?
> >
> >
>
>|||im not sure that's such a simple MDX statement
do you have granularity to the seconds dimension?
how many members do you have in this dim?
I would do this and see if it's a lot faster:
Select [Financial Period].[Fiscal].[Fiscal Year].MEMBERS on COLUMNS
FROM MyCube
and see if that's a lot faster.
-Aaron
jimmy wrote:
> Hi, Kaisa
> Thanks a lot for your suggestions. I have tried a very simple mdx with a
> middle size data set. e.g.
> SELECT NON EMPTY { } ON COLUMNS,
> { ([Financial Period].[Fiscal].[Fiscal Year].ALLMEMBERS ) } ON ROWS FROM
> [myCube]
> My computer has a 1GB RAM, not so bad...This query will take about 1
> second in my SQL server, however in ES it just hang up for hours and never
> get back again, much more than a cup of coffee time.
> I will try that on another computer to have a test and I do not think
> that will happen too.
> Do you think I should remove SQL server or Visual Studio and install
> again?Thanks.
>
> "Kaisa M. Lindahl Lervik" wrote:
> > I've found that if I create a huge data set with the mdx query builder, I
> > have to leave my computer to it and go get a cup of coffee while it chews
> > through the data.
> > Or you could add a few filters to it before starting the query execution, to
> > make sure the data set it returns is too big. Adding a date filter and make
> > it default to the last month or date will usually decrease the amount of
> > data returned.
> > My pc is running with 2 GB RAM and not a lot of applications in the back
> > ground. It still uses some time to chew through a data set that finishes
> > quite quickly in the SQL Server management studio, so I agree with you, it's
> > a RS issue more than an AS issue. You just have to be carefull about your
> > statement while using the builer, I guess.
> >
> > Kaisa M. Lindahl Lervik
> >
> >
> > "jimmy" <jimmy@.discussions.microsoft.com> wrote in message
> > news:7375D569-D9C8-4309-8BA6-E46C8582FE32@.microsoft.com...
> > > hello,
> > >
> > > I have some reports using OLAP cube as data sources. When I use mdx
> > > query builder to create any mdx statement as dataset, my computer will
> > > hang
> > > up and pop up a window says:
> > >
> > > Preparing Query: The query preparation is in process, to cancel, press
> > > CTRL+C for at least half a second.
> > >
> > > Even if I press CTRL+C for a long time, my computer still has no
> > > response and hang up forever. I have tried these mdx statement in my SQL
> > > server and they work fine. So this should not be an Analysis Serverices
> > > problem. Would you please tell me how to solve this problem?
> > >
> > >
> >
> >
> >

Computed Fields/Multiple Datasources

I am getting started with Reporting Services.
I am having trouble with computed fields. I have two issues:
1. I have a special dataset that I use to read parameters from a
database table. This table has only one row. I would like to add a
computed field that divides one of the columns in this row by another.
I created a computed field called ProRatedMultiplier with the following
definition:
=Fields!OPERATINGDAYSINMONTH.Value/Fields!INVOICINGDAY.Value
The problem is that when I insert this computed field into my report,
it wants to sum the output:
=Sum(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
If I remove the SUM() function, I get compile errors.
I need to use this computed value in many places on the report and thus
would like to have the formula defined only once (instead of repeating
it in each field).
It seems SRS sees it as returning one or more rows and thus wants to
aggregate. Am I going about this the wrong way? Can I make any changes
to make this work?
2. Assuming I get the above to work, I will have this new computed
field on my dataset. I would like to create a computed field on another
dataset that uses this first computed field value.
This new, second computed field would multiply the first computed field
value (which is a pro-rata multiplier) by the sum() aggregate of a
column in the second dataset.
The definition would like something like this:
=SUM( Fields!INVOICEAMOUNT.Value) *
Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS"
This also will not compile.
Am I going about this the wrong way?For #1:
Use the First aggregate function:
=First(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
So even if your InputDataDS dataset has more than one rows (for whatever
reasons), you will still get the expected result. Since you use the
calculated field value in another dataset, you cannot omit the aggregate
function (otherwise the fields collection would be scoped to the wrong
dataset).
For #2:
You could write an expression in a textbox like this:
=SUM( Fields!INVOICEAMOUNT.Value) * First(
Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
However, you cannot define a calculated field which uses aggregate
functions.
Probably a better solution for #1 & #2:
Since you have only 1 row - did you look into hidden textboxes, which
calculate the formulas instead of calculated fields? You could then
reference the value of the formula textbox in other textboxes by using an
expression like
=ReportItems!FormulaTextbox.Value
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hunter Hillegas" <hunter.hillegas@.gmail.com> wrote in message
news:chqjea$pq0@.odak26.prod.google.com...
> I am getting started with Reporting Services.
> I am having trouble with computed fields. I have two issues:
> 1. I have a special dataset that I use to read parameters from a
> database table. This table has only one row. I would like to add a
> computed field that divides one of the columns in this row by another.
> I created a computed field called ProRatedMultiplier with the following
> definition:
> =Fields!OPERATINGDAYSINMONTH.Value/Fields!INVOICINGDAY.Value
> The problem is that when I insert this computed field into my report,
> it wants to sum the output:
> =Sum(Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS")
> If I remove the SUM() function, I get compile errors.
> I need to use this computed value in many places on the report and thus
> would like to have the formula defined only once (instead of repeating
> it in each field).
> It seems SRS sees it as returning one or more rows and thus wants to
> aggregate. Am I going about this the wrong way? Can I make any changes
> to make this work?
> 2. Assuming I get the above to work, I will have this new computed
> field on my dataset. I would like to create a computed field on another
> dataset that uses this first computed field value.
> This new, second computed field would multiply the first computed field
> value (which is a pro-rata multiplier) by the sum() aggregate of a
> column in the second dataset.
> The definition would like something like this:
> =SUM( Fields!INVOICEAMOUNT.Value) *
> Fields!DailyInvoiceProRateMultiplier.Value, "InputDataDS"
> This also will not compile.
> Am I going about this the wrong way?
>

Friday, February 24, 2012

Complex IIF statement not working

I am not understanding what my issue is on this one! I can look at the data
returned from the dataset in Data view, but when I attempt to show a table
based on at least one value being true (from several) it says:
"The hidden expression for the table 'table1' refers to the field
'SSFLunchRegular'. Report item expressions can only refer to fields within
the current data set scope..."
I can turn right around and show/hide a row of the table based on the exact
same field name and it works. The structure of my IIF statment appears to be
fine because the same structure works in another report. Is it the number of
conditions? Is there a limit?
Here are the conditions placed on the Hidden statement:
=IIF(
(FIELDS!SLPLunchRegular.Value <> 0) and
(FIELDS!SLPLunchProv1.Value <> 0) and
(FIELDS!SLPLunchProv2.Value <> 0) and
(FIELDS!SLPLunchProv3.Value <> 0) and
(FIELDS!SLPBkfstRegular.Value <> 0) and
(FIELDS!SLPBkfstProv1.Value <> 0) and
(FIELDS!SLPBkfstProv2.Value <> 0) and
(FIELDS!SLPBkfstProv3.Value <> 0) and
(FIELDS!SLPSevereRegular.Value <> 0) and
(FIELDS!SLPSevereProv1.Value <> 0) and
(FIELDS!SLPSevereProv2.Value <> 0) and
(FIELDS!SLPSevereProv3.Value <> 0) and
(FIELDS!SLPSnackArea.Value <> 0) and
(FIELDS!SLPSnackNonArea.Value <> 0), False, True
)
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200511/1oops, I wrote 'SSFLunchRegular', it should have been 'SLPLunchRegular'. The
misspelling was in this thread, not my code so the problem is not solved..
Rick wrote:
>I am not understanding what my issue is on this one! I can look at the data
>returned from the dataset in Data view, but when I attempt to show a table
>based on at least one value being true (from several) it says:
>"The hidden expression for the table 'table1' refers to the field
>'SSFLunchRegular'. Report item expressions can only refer to fields within
>the current data set scope..."
>I can turn right around and show/hide a row of the table based on the exact
>same field name and it works. The structure of my IIF statment appears to be
>fine because the same structure works in another report. Is it the number of
>conditions? Is there a limit?
>Here are the conditions placed on the Hidden statement:
>=IIF(
>(FIELDS!SLPLunchRegular.Value <> 0) and
>(FIELDS!SLPLunchProv1.Value <> 0) and
>(FIELDS!SLPLunchProv2.Value <> 0) and
>(FIELDS!SLPLunchProv3.Value <> 0) and
>(FIELDS!SLPBkfstRegular.Value <> 0) and
>(FIELDS!SLPBkfstProv1.Value <> 0) and
>(FIELDS!SLPBkfstProv2.Value <> 0) and
>(FIELDS!SLPBkfstProv3.Value <> 0) and
>(FIELDS!SLPSevereRegular.Value <> 0) and
>(FIELDS!SLPSevereProv1.Value <> 0) and
>(FIELDS!SLPSevereProv2.Value <> 0) and
>(FIELDS!SLPSevereProv3.Value <> 0) and
>(FIELDS!SLPSnackArea.Value <> 0) and
>(FIELDS!SLPSnackNonArea.Value <> 0), False, True
>)
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200511/1|||The problem seems to be that you're attempting to hide a whole table based
on one single record. That wouldn't be logical. You'd need to aggregate the
values somehow, something like
=IIF(
(Sum(FIELDS!SLPLunchRegular.Value) <> 0) and
(Sum(FIELDS!SLPLunchProv1.Value) <> 0) and
...
...
Hope this helps.
--
Robert Jeppesen
Durius
http://www.durius.com/
"Rick via SQLMonster.com" <u15024@.uwe> wrote in message
news:5773f7edc9ca2@.uwe...
>I am not understanding what my issue is on this one! I can look at the
>data
> returned from the dataset in Data view, but when I attempt to show a table
> based on at least one value being true (from several) it says:
> "The hidden expression for the table 'table1' refers to the field
> 'SSFLunchRegular'. Report item expressions can only refer to fields
> within
> the current data set scope..."
> I can turn right around and show/hide a row of the table based on the
> exact
> same field name and it works. The structure of my IIF statment appears to
> be
> fine because the same structure works in another report. Is it the number
> of
> conditions? Is there a limit?
> Here are the conditions placed on the Hidden statement:
> =IIF(
> (FIELDS!SLPLunchRegular.Value <> 0) and
> (FIELDS!SLPLunchProv1.Value <> 0) and
> (FIELDS!SLPLunchProv2.Value <> 0) and
> (FIELDS!SLPLunchProv3.Value <> 0) and
> (FIELDS!SLPBkfstRegular.Value <> 0) and
> (FIELDS!SLPBkfstProv1.Value <> 0) and
> (FIELDS!SLPBkfstProv2.Value <> 0) and
> (FIELDS!SLPBkfstProv3.Value <> 0) and
> (FIELDS!SLPSevereRegular.Value <> 0) and
> (FIELDS!SLPSevereProv1.Value <> 0) and
> (FIELDS!SLPSevereProv2.Value <> 0) and
> (FIELDS!SLPSevereProv3.Value <> 0) and
> (FIELDS!SLPSnackArea.Value <> 0) and
> (FIELDS!SLPSnackNonArea.Value <> 0), False, True
> )
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200511/1

Complex Dataset Filtering

I have an Item Report that lists over 50,000 items, we need to restrict using
one of several different methods.
Some times they will run the report with all items (no Where clause in
the SQL Statement).
Some times they will want to see only the items they call "common"
which are stored in a table (normally I would just do a join to that table).
Lastly, they want to run the report for a specific item (where Item = @.ItemNumber)
I would prefer not to create three different reports.
My first hope was to create all three datasets and then dynamically assigne
the dataset depending on a paramater, I have not been able to accomplish this.
Any suggestion would sure be great.
TerryPiece of cake...well, not at all. I don't have the time to write a specific
answer right now, but I promise that next week I will do it.
By now, I'll copy-paste an answer that I gave in another forum. I hope it
helps you:
My scenario was the following.
I had a parameterized report. There's only one parameter (called @.id_acm)
and the values are taken from a query (in the report>report parameters...
menu I choose "From Query" instead of "non-queried" and so a drop down list
is shown to the user) The source query for the parameter values looked like
this:
SELECT id_acm AS param_value, nombre AS param_label
FROM tbl_acm
And the query used to get the information for the report (the one I wrote in
the DataSet) looked like this:
SELECT *
FROM tbl_sales S
INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acm
WHERE acm.id_acm = @.id_acm
I also did NOT specified any default value for the parameter.
When my boss executed the report he noticed that it showed anything until he
selected a value from the drop down list. My boss told me that he wanted to
see all the information by default, and if he needed information about a
specific person he would select the person from the drop down list. Here
comes the tricky part.
I noticed that all the current (and future) values for the id_acm field in
the tbl_acm table were greater than 0.
So I modified the source query for the parameter like this:
SELECT -5 AS param_value, 'Everyone' AS param_label
UNION
SELECT id_acm AS param_value, nombre AS param_label
FROM tbl_acm
And I specified a default value of -5 for the @.id_acm parameter.
Also, I modified the principal query like this:
IF @.id_acm = -5
BEGIN
SELECT *
FROM tbl_sales S
INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
END ELSE
BEGIN
SELECT *
FROM tbl_sales S
INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
WHERE acm.id_acm = @.id_acm
END
Let me explain this: when the user selects "Everyone" the principal query
returns the information of all the persons (because there's no WHERE clause)
If the user selects a specific name, then the principal query returns only
that person's information (because there's a WHERE clause filtering the data)
By default the paramter value is -5 and so the report shows everyone's
information.
Of course, if you have 2 parameters you'll have to nest 2 IF statemens. In
fact, if you have n parameters you'll have to nest n IF statemens and you'll
get 2^n posibilities for the WHERE clauses (that's the big pain)
I don't know if this helps in your scenario, but I hope it does.|||U Rock! That toally solved my problem.
I tried something simular prior but I really used more of a SQL Notation.
Thanks, I had all but givin up!
"F. Dwarf" wrote:
> Piece of cake...well, not at all. I don't have the time to write a specific
> answer right now, but I promise that next week I will do it.
> By now, I'll copy-paste an answer that I gave in another forum. I hope it
> helps you:
> My scenario was the following.
> I had a parameterized report. There's only one parameter (called @.id_acm)
> and the values are taken from a query (in the report>report parameters...
> menu I choose "From Query" instead of "non-queried" and so a drop down list
> is shown to the user) The source query for the parameter values looked like
> this:
> SELECT id_acm AS param_value, nombre AS param_label
> FROM tbl_acm
> And the query used to get the information for the report (the one I wrote in
> the DataSet) looked like this:
> SELECT *
> FROM tbl_sales S
> INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acm
> WHERE acm.id_acm = @.id_acm
> I also did NOT specified any default value for the parameter.
> When my boss executed the report he noticed that it showed anything until he
> selected a value from the drop down list. My boss told me that he wanted to
> see all the information by default, and if he needed information about a
> specific person he would select the person from the drop down list. Here
> comes the tricky part.
> I noticed that all the current (and future) values for the id_acm field in
> the tbl_acm table were greater than 0.
> So I modified the source query for the parameter like this:
> SELECT -5 AS param_value, 'Everyone' AS param_label
> UNION
> SELECT id_acm AS param_value, nombre AS param_label
> FROM tbl_acm
> And I specified a default value of -5 for the @.id_acm parameter.
> Also, I modified the principal query like this:
> IF @.id_acm = -5
> BEGIN
> SELECT *
> FROM tbl_sales S
> INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
> END ELSE
> BEGIN
> SELECT *
> FROM tbl_sales S
> INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
> WHERE acm.id_acm = @.id_acm
> END
> Let me explain this: when the user selects "Everyone" the principal query
> returns the information of all the persons (because there's no WHERE clause)
> If the user selects a specific name, then the principal query returns only
> that person's information (because there's a WHERE clause filtering the data)
> By default the paramter value is -5 and so the report shows everyone's
> information.
> Of course, if you have 2 parameters you'll have to nest 2 IF statemens. In
> fact, if you have n parameters you'll have to nest n IF statemens and you'll
> get 2^n posibilities for the WHERE clauses (that's the big pain)
> I don't know if this helps in your scenario, but I hope it does.|||What I do in my reports is something like
SELECT * FROM tbl_sales S
INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acm
WHERE (acm.id_acm = @.id_acm or @.id_acm = -5)
"Terry B" wrote:
> U Rock! That toally solved my problem.
> I tried something simular prior but I really used more of a SQL Notation.
> Thanks, I had all but givin up!
>
> "F. Dwarf" wrote:
> > Piece of cake...well, not at all. I don't have the time to write a specific
> > answer right now, but I promise that next week I will do it.
> > By now, I'll copy-paste an answer that I gave in another forum. I hope it
> > helps you:
> >
> > My scenario was the following.
> > I had a parameterized report. There's only one parameter (called @.id_acm)
> > and the values are taken from a query (in the report>report parameters...
> > menu I choose "From Query" instead of "non-queried" and so a drop down list
> > is shown to the user) The source query for the parameter values looked like
> > this:
> >
> > SELECT id_acm AS param_value, nombre AS param_label
> > FROM tbl_acm
> >
> > And the query used to get the information for the report (the one I wrote in
> > the DataSet) looked like this:
> > SELECT *
> > FROM tbl_sales S
> > INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acm
> > WHERE acm.id_acm = @.id_acm
> >
> > I also did NOT specified any default value for the parameter.
> >
> > When my boss executed the report he noticed that it showed anything until he
> > selected a value from the drop down list. My boss told me that he wanted to
> > see all the information by default, and if he needed information about a
> > specific person he would select the person from the drop down list. Here
> > comes the tricky part.
> > I noticed that all the current (and future) values for the id_acm field in
> > the tbl_acm table were greater than 0.
> > So I modified the source query for the parameter like this:
> >
> > SELECT -5 AS param_value, 'Everyone' AS param_label
> > UNION
> > SELECT id_acm AS param_value, nombre AS param_label
> > FROM tbl_acm
> >
> > And I specified a default value of -5 for the @.id_acm parameter.
> > Also, I modified the principal query like this:
> >
> > IF @.id_acm = -5
> > BEGIN
> > SELECT *
> > FROM tbl_sales S
> > INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
> > END ELSE
> > BEGIN
> > SELECT *
> > FROM tbl_sales S
> > INNER JOIN tbl_acm acm ON S.id_acm = acm.id_acb
> > WHERE acm.id_acm = @.id_acm
> > END
> >
> > Let me explain this: when the user selects "Everyone" the principal query
> > returns the information of all the persons (because there's no WHERE clause)
> > If the user selects a specific name, then the principal query returns only
> > that person's information (because there's a WHERE clause filtering the data)
> > By default the paramter value is -5 and so the report shows everyone's
> > information.
> > Of course, if you have 2 parameters you'll have to nest 2 IF statemens. In
> > fact, if you have n parameters you'll have to nest n IF statemens and you'll
> > get 2^n posibilities for the WHERE clauses (that's the big pain)
> > I don't know if this helps in your scenario, but I hope it does.