Monday, February 20, 2012

mdx parameter problem to get a smaller dataset

We have 2 reports in reporting services 2005.
The first one gives a global overview and with a drillthrough link, you
get the second report for more details. The second report is getting
back the whole dataset out of our dwh and is giving an
outofmemoryexception.
I'm trying to reduce the dataset with the parameters from the first
report, but I get always some errors.
Below you can find my mdx-query. When I'm using hard coded values it's
working, but when I'm using the parameters then the preview of my
report gives some nasty erros:
"Report item expressions can only refer to fields within the current
data set scope or, if inside an aggregate, the specified data set
scope."
my report parameters:
GrootboekGrootboekNR
BoekjaarTeller
my mdx-query:
SELECT NON EMPTY { [Measures].[BUDGET BEDRAG BM], [Measures].[GROOTBOEK
BEDRAG BASIS MUNT] } ON COLUMNS, NON EMPTY {
([Boekperiode].[BoekPeriode].[BoekPeriode].ALLMEMBERS *
[Grootboek].[Grootboek_naam].[Grootboek_naam].ALLMEMBERS *
[Kostensoort].[Kostensoort_NR].[Kostensoort_NR].ALLMEMBERS *
[Kostensoort].[Kostensoort_naam].[Kostensoort_naam].ALLMEMBERS *
[Document_datum].[ddate].[ddate].ALLMEMBERS *
[DagboekCode].[DagboekCode].[DagboekCode].ALLMEMBERS *
[Organisatie].[Lid NR].[Lid NR].ALLMEMBERS * [Grootboek Rekening
Courant].[Grootboek Rekening Courant].[Grootboek Rekening
Courant].ALLMEMBERS * [Grootboek Rekening Courant].[Rekening Courant
Naam].[Rekening Courant Naam].ALLMEMBERS * [fd Grootboek Transactie
Omschrijving].[Grootboek Transactie Omschrijving].[Grootboek Transactie
Omschrijving].ALLMEMBERS * [fd Grootboek Document NR].[Grootboek
Document NR].[Grootboek Document NR].ALLMEMBERS ) } DIMENSION
PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( {
[BoekjaarTeller].[BoekjaarTeller].&[5] } ) ON COLUMNS FROM ( SELECT ( {
[Grootboek].[Grootboek_GR1].&[6], [Grootboek].[Grootboek_GR1].&[7] } )
ON COLUMNS FROM ( SELECT ( { [Organisatie].[Lid NR].&[ACCO] } ) ON
COLUMNS FROM [AcertFin]))) WHERE
([Grootboek].[Grootboek_GR1].CurrentMember,
[Grootboek].[Grootboek_NR].[Grootboek_NR].[" +
parameters!GrootboekGrootboekNR.Label +"],
[BoekjaarTeller].[BoekjaarTeller].[BoekjaarTeller].["+parameters!BoekjaarTeller.Label+"])
I've read also that you've to use ="..." to get a mdx expression, but
when I try that I'm getting errors about the =-sign.When it comes do dynamic queries, everything needs to be on the same line,
no extra lines are allowed. My best tip is to take the whole statement, put
it into Notepad, and turn off Word Wrap. Then make the whole query into a
very long line (it might break at some point, but try getting it all on one
line.)
If you need quotes inside the query, you need to escape them. Add another
quote in front and one behind, I think. (Properties("Key") will have to be
Properties("""Key""") I think.)
Some strings are casesensitive, so make sure you type Parameters with a big
P and also the parameter names.
I prefer using & instead of + when it comes to adding string values, but I'm
not sure if that has anything to say.
Make sure you have a space between " and & (or +), sometimes it gets funny
if you write it without spaces.
[BoekjaarTeller].[BoekjaarTeller].[BoekjaarTeller].["+parameters!BoekjaarTeller.Label+"]"
should be [BoekjaarTeller].[BoekjaarTeller].[BoekjaarTeller].[" &
Parameters!BoekjaarTeller.Label & "]
Also, check what the output of the Parameters!YourParameter.Label is. If it
sends out the wrong string, the query will fail.
How do you trigger the second report? URL? Again, check what the paramters
are in the link. Not sure if subreports uses the "drop down" parameters of
the main report, or if they use the parameter output from the hyperlink. If
your subreport query expects "1001" and gets "(1001) My book", your query
will fail. (I've had that problem, a link in a main report returned a
different member property than I expected.)
Kaisa
herman" <herman.maes@.gmail.com> wrote in message
news:1136364042.661254.230140@.f14g2000cwb.googlegroups.com...
> We have 2 reports in reporting services 2005.
> The first one gives a global overview and with a drillthrough link, you
> get the second report for more details. The second report is getting
> back the whole dataset out of our dwh and is giving an
> outofmemoryexception.
> I'm trying to reduce the dataset with the parameters from the first
> report, but I get always some errors.
> Below you can find my mdx-query. When I'm using hard coded values it's
> working, but when I'm using the parameters then the preview of my
> report gives some nasty erros:
> "Report item expressions can only refer to fields within the current
> data set scope or, if inside an aggregate, the specified data set
> scope."
> my report parameters:
> GrootboekGrootboekNR
> BoekjaarTeller
> my mdx-query:
> SELECT NON EMPTY { [Measures].[BUDGET BEDRAG BM], [Measures].[GROOTBOEK
> BEDRAG BASIS MUNT] } ON COLUMNS, NON EMPTY {
> ([Boekperiode].[BoekPeriode].[BoekPeriode].ALLMEMBERS *
> [Grootboek].[Grootboek_naam].[Grootboek_naam].ALLMEMBERS *
> [Kostensoort].[Kostensoort_NR].[Kostensoort_NR].ALLMEMBERS *
> [Kostensoort].[Kostensoort_naam].[Kostensoort_naam].ALLMEMBERS *
> [Document_datum].[ddate].[ddate].ALLMEMBERS *
> [DagboekCode].[DagboekCode].[DagboekCode].ALLMEMBERS *
> [Organisatie].[Lid NR].[Lid NR].ALLMEMBERS * [Grootboek Rekening
> Courant].[Grootboek Rekening Courant].[Grootboek Rekening
> Courant].ALLMEMBERS * [Grootboek Rekening Courant].[Rekening Courant
> Naam].[Rekening Courant Naam].ALLMEMBERS * [fd Grootboek Transactie
> Omschrijving].[Grootboek Transactie Omschrijving].[Grootboek Transactie
> Omschrijving].ALLMEMBERS * [fd Grootboek Document NR].[Grootboek
> Document NR].[Grootboek Document NR].ALLMEMBERS ) } DIMENSION
> PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( {
> [BoekjaarTeller].[BoekjaarTeller].&[5] } ) ON COLUMNS FROM ( SELECT ( {
> [Grootboek].[Grootboek_GR1].&[6], [Grootboek].[Grootboek_GR1].&[7] } )
> ON COLUMNS FROM ( SELECT ( { [Organisatie].[Lid NR].&[ACCO] } ) ON
> COLUMNS FROM [AcertFin]))) WHERE
> ([Grootboek].[Grootboek_GR1].CurrentMember,
> [Grootboek].[Grootboek_NR].[Grootboek_NR].[" +
> parameters!GrootboekGrootboekNR.Label +"],
> [BoekjaarTeller].[BoekjaarTeller].[BoekjaarTeller].["+parameters!BoekjaarTeller.Label+"])
> I've read also that you've to use ="..." to get a mdx expression, but
> when I try that I'm getting errors about the =-sign.
>

No comments:

Post a Comment