Showing posts with label drop. Show all posts
Showing posts with label drop. Show all posts

Friday, March 30, 2012

Multivalue Parameter SQL Server 2005 SP1

Hello, I've installed SP1 for SQl Server 2005 and I noticed that the option "Select all" on a multi value parameter drop down (using web browser) is missing. Even if I can see it on VS 2005.....
Anyone can help me?
Thank you very much.
I rely on the 'Select All' capability as well. How can I get it back now that I've upgraded to SP1?|||

I finally found the answer on this. SP1 removes the 'Select All' capability previously applied when choosing the 'multi-value' option on a parameter list. Could not easily find this in the Release Notes.

I finally found it by looking through the updated version of the 'Books Online'. I must admit I understand the logic behind changing things here and the revised approach will make for more efficient queries (at the expense of recoding) - but it would be nice to know things prior to installing the SP - not after.

FYI - if, like me you develop on one system, and deploy to another, you can continue to develop on 2005/SP1, deploy to a 2005/non-SP1 system and things will work as before. Once you update the deployment target system to 2005/SP1 - the option is gone and you'll have to go back and do the parameter dataset recoding as outlined in the updated Books Online.

Bob

|||

Where did you find this information in Books Online? Can you provide a link? I'd like to take a closer look, because we also use this feature (which is admittedly funky) extensively.

Joe

|||

There is updated BOL contents available on MSDN which explains how to change SQL-based queries to simulate the "ALL" element: http://msdn2.microsoft.com/en-us/library/ms155917.aspx (scroll to the section about "Adding an All Member to a Multivalue Parameter").

-- Robert

|||

i believe there is also a hotfix available for this problem

|||

Do you have a link to the hotfix?

michael

|||http://support.microsoft.com/kb/918222|||

Thank you very much.

Michael

|||

Hello,

I faced the problem that on my development server <select all> was displaying and on the production it was not due to SP2 on development compared to SP1 on production.

SP2 was then loaded on the production server and rebooted the machine even then the <select all> cannot be seen. Would i need to reload the report or any futher fixes.

I know I am close to reaching a solution

Thanks

Multivalue Parameter SQL Server 2005 SP1

Hello, I've installed SP1 for SQl Server 2005 and I noticed that the option "Select all" on a multi value parameter drop down (using web browser) is missing. Even if I can see it on VS 2005.....
Anyone can help me?
Thank you very much.I rely on the 'Select All' capability as well. How can I get it back now that I've upgraded to SP1?|||

I finally found the answer on this. SP1 removes the 'Select All' capability previously applied when choosing the 'multi-value' option on a parameter list. Could not easily find this in the Release Notes.

I finally found it by looking through the updated version of the 'Books Online'. I must admit I understand the logic behind changing things here and the revised approach will make for more efficient queries (at the expense of recoding) - but it would be nice to know things prior to installing the SP - not after.

FYI - if, like me you develop on one system, and deploy to another, you can continue to develop on 2005/SP1, deploy to a 2005/non-SP1 system and things will work as before. Once you update the deployment target system to 2005/SP1 - the option is gone and you'll have to go back and do the parameter dataset recoding as outlined in the updated Books Online.

Bob

|||

Where did you find this information in Books Online? Can you provide a link? I'd like to take a closer look, because we also use this feature (which is admittedly funky) extensively.

Joe

|||

There is updated BOL contents available on MSDN which explains how to change SQL-based queries to simulate the "ALL" element: http://msdn2.microsoft.com/en-us/library/ms155917.aspx (scroll to the section about "Adding an All Member to a Multivalue Parameter").

-- Robert

|||

i believe there is also a hotfix available for this problem

|||

Do you have a link to the hotfix?

michael

|||http://support.microsoft.com/kb/918222|||

Thank you very much.

Michael

|||

Hello,

I faced the problem that on my development server <select all> was displaying and on the production it was not due to SP2 on development compared to SP1 on production.

SP2 was then loaded on the production server and rebooted the machine even then the <select all> cannot be seen. Would i need to reload the report or any futher fixes.

I know I am close to reaching a solution

Thanks

sql

Multivalue Parameter SQL Server 2005 SP1

Hello, I've installed SP1 for SQl Server 2005 and I noticed that the option "Select all" on a multi value parameter drop down (using web browser) is missing. Even if I can see it on VS 2005.....
Anyone can help me?
Thank you very much.
I rely on the 'Select All' capability as well. How can I get it back now that I've upgraded to SP1?|||

I finally found the answer on this. SP1 removes the 'Select All' capability previously applied when choosing the 'multi-value' option on a parameter list. Could not easily find this in the Release Notes.

I finally found it by looking through the updated version of the 'Books Online'. I must admit I understand the logic behind changing things here and the revised approach will make for more efficient queries (at the expense of recoding) - but it would be nice to know things prior to installing the SP - not after.

FYI - if, like me you develop on one system, and deploy to another, you can continue to develop on 2005/SP1, deploy to a 2005/non-SP1 system and things will work as before. Once you update the deployment target system to 2005/SP1 - the option is gone and you'll have to go back and do the parameter dataset recoding as outlined in the updated Books Online.

Bob

|||

Where did you find this information in Books Online? Can you provide a link? I'd like to take a closer look, because we also use this feature (which is admittedly funky) extensively.

Joe

|||

There is updated BOL contents available on MSDN which explains how to change SQL-based queries to simulate the "ALL" element: http://msdn2.microsoft.com/en-us/library/ms155917.aspx (scroll to the section about "Adding an All Member to a Multivalue Parameter").

-- Robert

|||

i believe there is also a hotfix available for this problem

|||

Do you have a link to the hotfix?

michael

|||http://support.microsoft.com/kb/918222|||

Thank you very much.

Michael

|||

Hello,

I faced the problem that on my development server <select all> was displaying and on the production it was not due to SP2 on development compared to SP1 on production.

SP2 was then loaded on the production server and rebooted the machine even then the <select all> cannot be seen. Would i need to reload the report or any futher fixes.

I know I am close to reaching a solution

Thanks

Multivalue Parameter SQL Server 2005 SP1

Hello, I've installed SP1 for SQl Server 2005 and I noticed that the option "Select all" on a multi value parameter drop down (using web browser) is missing. Even if I can see it on VS 2005.....
Anyone can help me?
Thank you very much.
I rely on the 'Select All' capability as well. How can I get it back now that I've upgraded to SP1?|||

I finally found the answer on this. SP1 removes the 'Select All' capability previously applied when choosing the 'multi-value' option on a parameter list. Could not easily find this in the Release Notes.

I finally found it by looking through the updated version of the 'Books Online'. I must admit I understand the logic behind changing things here and the revised approach will make for more efficient queries (at the expense of recoding) - but it would be nice to know things prior to installing the SP - not after.

FYI - if, like me you develop on one system, and deploy to another, you can continue to develop on 2005/SP1, deploy to a 2005/non-SP1 system and things will work as before. Once you update the deployment target system to 2005/SP1 - the option is gone and you'll have to go back and do the parameter dataset recoding as outlined in the updated Books Online.

Bob

|||

Where did you find this information in Books Online? Can you provide a link? I'd like to take a closer look, because we also use this feature (which is admittedly funky) extensively.

Joe

|||

There is updated BOL contents available on MSDN which explains how to change SQL-based queries to simulate the "ALL" element: http://msdn2.microsoft.com/en-us/library/ms155917.aspx (scroll to the section about "Adding an All Member to a Multivalue Parameter").

-- Robert

|||

i believe there is also a hotfix available for this problem

|||

Do you have a link to the hotfix?

michael

|||http://support.microsoft.com/kb/918222|||

Thank you very much.

Michael

|||

Hello,

I faced the problem that on my development server <select all> was displaying and on the production it was not due to SP2 on development compared to SP1 on production.

SP2 was then loaded on the production server and rebooted the machine even then the <select all> cannot be seen. Would i need to reload the report or any futher fixes.

I know I am close to reaching a solution

Thanks

Multivalue Parameter SQL Server 2005 SP1

Hello, I've installed SP1 for SQl Server 2005 and I noticed that the option "Select all" on a multi value parameter drop down (using web browser) is missing. Even if I can see it on VS 2005.....
Anyone can help me?
Thank you very much.I rely on the 'Select All' capability as well. How can I get it back now that I've upgraded to SP1?|||

I finally found the answer on this. SP1 removes the 'Select All' capability previously applied when choosing the 'multi-value' option on a parameter list. Could not easily find this in the Release Notes.

I finally found it by looking through the updated version of the 'Books Online'. I must admit I understand the logic behind changing things here and the revised approach will make for more efficient queries (at the expense of recoding) - but it would be nice to know things prior to installing the SP - not after.

FYI - if, like me you develop on one system, and deploy to another, you can continue to develop on 2005/SP1, deploy to a 2005/non-SP1 system and things will work as before. Once you update the deployment target system to 2005/SP1 - the option is gone and you'll have to go back and do the parameter dataset recoding as outlined in the updated Books Online.

Bob

|||

Where did you find this information in Books Online? Can you provide a link? I'd like to take a closer look, because we also use this feature (which is admittedly funky) extensively.

Joe

|||

There is updated BOL contents available on MSDN which explains how to change SQL-based queries to simulate the "ALL" element: http://msdn2.microsoft.com/en-us/library/ms155917.aspx (scroll to the section about "Adding an All Member to a Multivalue Parameter").

-- Robert

|||

i believe there is also a hotfix available for this problem

|||

Do you have a link to the hotfix?

michael

|||http://support.microsoft.com/kb/918222|||

Thank you very much.

Michael

|||

Hello,

I faced the problem that on my development server <select all> was displaying and on the production it was not due to SP2 on development compared to SP1 on production.

SP2 was then loaded on the production server and rebooted the machine even then the <select all> cannot be seen. Would i need to reload the report or any futher fixes.

I know I am close to reaching a solution

Thanks

MultiValue Parameter Help

I have passed a list of parameters to a multivalue parameter in a SQL Report.

I can click the drop down and see the list of parameters that were passed.

In my select statement for the report, here is the condition I am using in the where clause.

AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN (@.RUs))

Nothing is returned in the result set if more than one value is passed to the multivalue parameter.

Shouldn't the above conidition have the effect that no matter how many account numbers there are, the last three digits in the account number will be compared to each element in my multivalue parameter and if there is a match, it will be selected on the report.

For example, in the multivalue dropdown list, there are the following values:

211

212

If I pass 211 to the report, data is returned. If I pass 211, 212 to the multivalue parameter no data is returned.

what is the value type for your MV paramater? Is it the same as the sql value type?

|||

>>Shouldn't the above conidition have the effect that no matter how many account numbers there are

You might think so, but no <g>. You have to build the SQL, there's no magic here that allows the SQL to automatically understand a collection of values -- which is what the multiselect parameter is.

I'll assume that your values for the dropdown list are string-type, because that is the hardest case usually and because you're using SUBSTRING() on your data column...

You need to construct your SQL something like this:

="SELECT " & blah blah blah & "WHERE " & blah blah &

" AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN ('" &

JOIN(Parameters!RUs.Value,"','") & "') "

... the use of red in the expression above is just to make sure you can see the single quotes versus the double quotes. I don't want to add spaces between the characters because those spaces would destroy the syntax we're trying to build.

What I'm trying to show you is that you need to end up with a SQL expression that has the delimited strings in an IN clause -- IN ('211','212') -- and that, while annoying when expressed as above, it is possible to do it <s>. This is because the JOIN function will take the various values for each of the parameter values in the collection and concatenate them with a delimiter that, in this case, is three characters long: ',' .

We add the outside or "embracing" single quote delimiters for the first and last items in the collection manually.

If there is only one item in the dropdown selected, the JOIN doesn't add anything but the one value, and the result is (say) IN ('211'), perfectly valid.

If you find it annoying to look at the SQL this way (I do) you can do what I've advised others to do several times in similar situations: just write a query that looks like this:

=Code.GetSQL()

... and write a little embedded Function GetSQL() AS String in your report, that returns the query as a string. You'll write a more maintainable version of the parsing code if you don't have to do it all in-line as above. If you need to do any type conversions or iterate through the parameter collection for any other reason, it will be easier.

HTH,

>L<

|||

Lisa:

Thank you so much for such an involved reply. I like that answer and feel that you are most likely correct. However, I'm having trouble getting that to work for me.

Is the JOIN function that you are using in your code the one that can be used by right clicking a field on the layout tab of the report and selecting expression?

I'm not sure how I can use that JOIN in the SQL select statement on the Data tab. It doesn't seem to me that the code you have shown can be used in a standard select statement. How would I do that? As far as I know, JOIN in "natural SQL" can be INNER JOIN, OUTER JOIN, etc. However, I've never seen just JOIN used as you have here.

Also you've used the Parameters!RUs.Value syntax here. Shouldn't that be @.RUs as it is the data portion of the report and not the layout of the report?

Mainiac007:

The RUs parameter in my stored procedure is varchar(1000).

The multivalue report parameter is of type String.

The ChartOfAccountsAccountNo is of type varchar(24).

|||

the JOIN she is referring to is not a sql command but a vb function.

|||

HI there,

I'm sorry the reply was involved -- unfortunately it has to be <s>. I've seen a bunch of people saying you can't do this, which is why I bothered to write out the whole thing <s>. And it seems I guessed right about your data types, so you did need the full information.

To answer your question(s), and I promise it really does work <s>.... Look really carefully at the expression I wrote:

I didn't write a SQL statement. I wrote an EXPRESSION which, when evaluated, is a SQL statement.

Notice the = at the beginning. Notice the double quotes -- that's VB expression quotes, not SQL delimiters -- around the parts of the expression.

Notice, also, that I said in my reply that you could do the same thing by using the expression =Code.GetSql(), where GetSql is an embedded function in the Report Code. Obviously the SQL engine wouldn't understand Code.GetSql() either, but that makes no difference <s>.

Either way, in-line expression or function, the *returned result* of the expression is a valid SQL statement, which has been dynamically built up from strings to meet your requirements. The string which has been built up is what is going to get sent to the SQL engine, not the expression that created it.

As for why I used Parameters!RUs.Value rather than @.RUs, I think that will be obvious when you grok what I just said <s>. I'm not talking SQL when I'm creating the string. I'm talking report-scoped object syntax, and I'm talking to the collection of parameter objects that represents your multi-select parameter. The JOIN function is VB, and I'm using it in a way that is entirely appropriate to the problem at hand. (Considering the number of times I have seen people say "you can't do that with string values", I flatter myself that it's a pretty cool idea, too <g>.)

Does this make more sense now?

>L<

|||I could not have said it better myself.|||

>> I could not have said it better myself

gee thanks <rofl> No offense, Maniac007, but ...

you were one of the people who appeared to need help on this exact issue and hence one of the reasons I posted (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1012961&SiteID=1) .

>L<

|||yup, that was LAST year.... since then 6 months of working with ssrs has taught me a lot.|||

Sorry, Mainiac007, I didn't mean you didn't *know* this. I meant it was obviously hard to write out and explain -- otherwise, obviously, you or many other people who post here would have done it <s>.

I've avoided explaining it many times as well, this time I just decided to bite the bullet. Let's hope the explanation is sufficiently clear and that people link to this thread as necessary.

>L<

|||

My wife would kill me for saying this....but,,,,

"Just like a women, to have the last word."

|||

Lisa,

Thank you so much for your help. I think I'm at least following you now, but I still have an error in my SELECT statement and I can't seem to figure out what it is.

The error I get when running the report is: Incorrect syntax near 'GL_TRX'.

|||

what are you summing this as...

SUM(GL_TRX.GLTRXAMOUNT) as what?|||

There are a couple of things that I see...

1. As Mainiac007 has already told you, you probably need an alias on your calculated (SUM(GL_TRX.GLTRXAMOUNT)) field.

2. Remember what I told you about those extra spaces you can't put in? Well, you put them in <g>.

" AND (SUBSTRING(CHART_OF_ACCOUNTS.CHARTOFACCTSACCOUNTNO,9,3) IN (' " &

JOIN(Parameters!RUs.Value," ',' ") & " ') " ...

you need to remove the extra spaces you put in, in all the places I marked in red where you have a single and double quote next to each other. Do you see why? Let's say your parameter value is XYZ. You want the chart of accts substring to match 'XYZ', you don't want it to match SPACE(1) + 'XYZ' + SPACE(1). Or, you could leave the spaces in but then you would have to change your substring expression to delimit with a space on either side.

3. I don't think that, when you're using a dynamically constructed query like this, you should use explicit params the way you're doing it embedded in the strings. It may work in some instances, it doesn't work out too well for me. So, instead of

"GL_TRX.GLTRXDATE BETWEEN @.StartDate AND @.EndDate"

... I would write:

"GL_TRX.GLTRXDATE BETWEEN '" & CSTR(@.StartDate) & "' AND '" & CSTR(@.EndDate) & "' "

... or something like that. Notice I've put the single quotes in red again so you can see them next to the double quotes.

4. I have two suggestions for you that might help you debug and also make the code less messy to maintain:

The first, I've already suggested (put the sql creation into an embedded proc so you can break it up and read what you are doing, append into a StringBuilder or whatever and then return the full statement.ToString() when you're done.)

The second is to create a simple report with the same parameters and have a text box that has the same expression building syntax you're using here. It doesn't matter what the rest of the report looks like, you just want one big textbox so that you can read it. Here's why this is a good idea:

* -- if you have basic VB-syntax problems, you'll know because the report won't be able to parse what you did when you try to preview it

* -- if you don't have a VB-syntax problem, you'll see what you did in the body of the report. You should be able to copy and paste it somewhere else and run it as sql. If it's correct, it will run. If not, you'll be able to see why <g>.

* -- once you get it right, you can move that same expression-building code into the "real" report.

HTH,

>L<

|||

I have just run into a similiar situation. Where I have to pass a parameter (multi value) to a stored procedure.

The sproc use a where filed in(@.Centers) command.

When I select 1 value it works fine, when I select all or more then one, then no data is returned.

It seems the value returned from the MV is one,two,three. etc...

where to accurately pass this it should be 'one',two','three'

a hint on how to get it done this way?

MultiValue Parameter Help

I have passed a list of parameters to a multivalue parameter in a SQL Report.

I can click the drop down and see the list of parameters that were passed.

In my select statement for the report, here is the condition I am using in the where clause.

AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN (@.RUs))

Nothing is returned in the result set if more than one value is passed to the multivalue parameter.

Shouldn't the above conidition have the effect that no matter how many account numbers there are, the last three digits in the account number will be compared to each element in my multivalue parameter and if there is a match, it will be selected on the report.

For example, in the multivalue dropdown list, there are the following values:

211

212

If I pass 211 to the report, data is returned. If I pass 211, 212 to the multivalue parameter no data is returned.

what is the value type for your MV paramater? Is it the same as the sql value type?

|||

>>Shouldn't the above conidition have the effect that no matter how many account numbers there are

You might think so, but no <g>. You have to build the SQL, there's no magic here that allows the SQL to automatically understand a collection of values -- which is what the multiselect parameter is.

I'll assume that your values for the dropdown list are string-type, because that is the hardest case usually and because you're using SUBSTRING() on your data column...

You need to construct your SQL something like this:

="SELECT " & blah blah blah & "WHERE " & blah blah &

" AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN ('" &

JOIN(Parameters!RUs.Value,"','") & "') "

... the use of red in the expression above is just to make sure you can see the single quotes versus the double quotes. I don't want to add spaces between the characters because those spaces would destroy the syntax we're trying to build.

What I'm trying to show you is that you need to end up with a SQL expression that has the delimited strings in an IN clause -- IN ('211','212') -- and that, while annoying when expressed as above, it is possible to do it <s>. This is because the JOIN function will take the various values for each of the parameter values in the collection and concatenate them with a delimiter that, in this case, is three characters long: ',' .

We add the outside or "embracing" single quote delimiters for the first and last items in the collection manually.

If there is only one item in the dropdown selected, the JOIN doesn't add anything but the one value, and the result is (say) IN ('211'), perfectly valid.

If you find it annoying to look at the SQL this way (I do) you can do what I've advised others to do several times in similar situations: just write a query that looks like this:

=Code.GetSQL()

... and write a little embedded Function GetSQL() AS String in your report, that returns the query as a string. You'll write a more maintainable version of the parsing code if you don't have to do it all in-line as above. If you need to do any type conversions or iterate through the parameter collection for any other reason, it will be easier.

HTH,

>L<

|||

Lisa:

Thank you so much for such an involved reply. I like that answer and feel that you are most likely correct. However, I'm having trouble getting that to work for me.

Is the JOIN function that you are using in your code the one that can be used by right clicking a field on the layout tab of the report and selecting expression?

I'm not sure how I can use that JOIN in the SQL select statement on the Data tab. It doesn't seem to me that the code you have shown can be used in a standard select statement. How would I do that? As far as I know, JOIN in "natural SQL" can be INNER JOIN, OUTER JOIN, etc. However, I've never seen just JOIN used as you have here.

Also you've used the Parameters!RUs.Value syntax here. Shouldn't that be @.RUs as it is the data portion of the report and not the layout of the report?

Mainiac007:

The RUs parameter in my stored procedure is varchar(1000).

The multivalue report parameter is of type String.

The ChartOfAccountsAccountNo is of type varchar(24).

|||

the JOIN she is referring to is not a sql command but a vb function.

|||

HI there,

I'm sorry the reply was involved -- unfortunately it has to be <s>. I've seen a bunch of people saying you can't do this, which is why I bothered to write out the whole thing <s>. And it seems I guessed right about your data types, so you did need the full information.

To answer your question(s), and I promise it really does work <s>.... Look really carefully at the expression I wrote:

I didn't write a SQL statement. I wrote an EXPRESSION which, when evaluated, is a SQL statement.

Notice the = at the beginning. Notice the double quotes -- that's VB expression quotes, not SQL delimiters -- around the parts of the expression.

Notice, also, that I said in my reply that you could do the same thing by using the expression =Code.GetSql(), where GetSql is an embedded function in the Report Code. Obviously the SQL engine wouldn't understand Code.GetSql() either, but that makes no difference <s>.

Either way, in-line expression or function, the *returned result* of the expression is a valid SQL statement, which has been dynamically built up from strings to meet your requirements. The string which has been built up is what is going to get sent to the SQL engine, not the expression that created it.

As for why I used Parameters!RUs.Value rather than @.RUs, I think that will be obvious when you grok what I just said <s>. I'm not talking SQL when I'm creating the string. I'm talking report-scoped object syntax, and I'm talking to the collection of parameter objects that represents your multi-select parameter. The JOIN function is VB, and I'm using it in a way that is entirely appropriate to the problem at hand. (Considering the number of times I have seen people say "you can't do that with string values", I flatter myself that it's a pretty cool idea, too <g>.)

Does this make more sense now?

>L<

|||I could not have said it better myself.|||

>> I could not have said it better myself

gee thanks <rofl> No offense, Maniac007, but ...

you were one of the people who appeared to need help on this exact issue and hence one of the reasons I posted (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1012961&SiteID=1) .

>L<

|||yup, that was LAST year.... since then 6 months of working with ssrs has taught me a lot.|||

Sorry, Mainiac007, I didn't mean you didn't *know* this. I meant it was obviously hard to write out and explain -- otherwise, obviously, you or many other people who post here would have done it <s>.

I've avoided explaining it many times as well, this time I just decided to bite the bullet. Let's hope the explanation is sufficiently clear and that people link to this thread as necessary.

>L<

|||

My wife would kill me for saying this....but,,,,

"Just like a women, to have the last word."

|||

Lisa,

Thank you so much for your help. I think I'm at least following you now, but I still have an error in my SELECT statement and I can't seem to figure out what it is.

The error I get when running the report is: Incorrect syntax near 'GL_TRX'.

|||

what are you summing this as...

SUM(GL_TRX.GLTRXAMOUNT) as what?

|||

There are a couple of things that I see...

1. As Mainiac007 has already told you, you probably need an alias on your calculated (SUM(GL_TRX.GLTRXAMOUNT)) field.

2. Remember what I told you about those extra spaces you can't put in? Well, you put them in <g>.

" AND (SUBSTRING(CHART_OF_ACCOUNTS.CHARTOFACCTSACCOUNTNO,9,3) IN (' " &

JOIN(Parameters!RUs.Value," ',' ") & " ') " ...

you need to remove the extra spaces you put in, in all the places I marked in red where you have a single and double quote next to each other. Do you see why? Let's say your parameter value is XYZ. You want the chart of accts substring to match 'XYZ', you don't want it to match SPACE(1) + 'XYZ' + SPACE(1). Or, you could leave the spaces in but then you would have to change your substring expression to delimit with a space on either side.

3. I don't think that, when you're using a dynamically constructed query like this, you should use explicit params the way you're doing it embedded in the strings. It may work in some instances, it doesn't work out too well for me. So, instead of

"GL_TRX.GLTRXDATE BETWEEN @.StartDate AND @.EndDate"

... I would write:

"GL_TRX.GLTRXDATE BETWEEN '" & CSTR(@.StartDate) & "' AND '" & CSTR(@.EndDate) & "' "

... or something like that. Notice I've put the single quotes in red again so you can see them next to the double quotes.

4. I have two suggestions for you that might help you debug and also make the code less messy to maintain:

The first, I've already suggested (put the sql creation into an embedded proc so you can break it up and read what you are doing, append into a StringBuilder or whatever and then return the full statement.ToString() when you're done.)

The second is to create a simple report with the same parameters and have a text box that has the same expression building syntax you're using here. It doesn't matter what the rest of the report looks like, you just want one big textbox so that you can read it. Here's why this is a good idea:

* -- if you have basic VB-syntax problems, you'll know because the report won't be able to parse what you did when you try to preview it

* -- if you don't have a VB-syntax problem, you'll see what you did in the body of the report. You should be able to copy and paste it somewhere else and run it as sql. If it's correct, it will run. If not, you'll be able to see why <g>.

* -- once you get it right, you can move that same expression-building code into the "real" report.

HTH,

>L<

|||

I have just run into a similiar situation. Where I have to pass a parameter (multi value) to a stored procedure.

The sproc use a where filed in(@.Centers) command.

When I select 1 value it works fine, when I select all or more then one, then no data is returned.

It seems the value returned from the MV is one,two,three. etc...

where to accurately pass this it should be 'one',two','three'

a hint on how to get it done this way?

MultiValue Parameter Help

I have passed a list of parameters to a multivalue parameter in a SQL Report.

I can click the drop down and see the list of parameters that were passed.

In my select statement for the report, here is the condition I am using in the where clause.

AND(SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3)IN(@.RUs))

Nothing is returned in the result set if more than one value is passed to the multivalue parameter.

Shouldn't the above conidition have the effect that no matter how many account numbers there are, the last three digits in the account number will be compared to each element in my multivalue parameter and if there is a match, it will be selected on the report.

For example, in the multivalue dropdown list, there are the following values:

211

212

If I pass 211 to the report, data is returned. If I pass 211, 212 to the multivalue parameter no data is returned.

what is the value type for your MV paramater? Is it the same as the sql value type?

|||

>>Shouldn't the above conidition have the effect that no matter how many account numbers there are

You might think so, but no <g>. You have to build the SQL, there's no magic here that allows the SQL to automatically understand a collection of values -- which is what the multiselect parameter is.

I'll assume that your values for the dropdown list are string-type, because that is the hardest case usually and because you're using SUBSTRING() on your data column...

You need to construct your SQL something like this:

="SELECT " & blah blah blah & "WHERE " & blah blah &

" AND(SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN ('" &

JOIN(Parameters!RUs.Value,"','") & "') "

... the use of red in the expression above is just to make sure you can see the single quotes versus the double quotes. I don't want to add spaces between the characters because those spaces would destroy the syntax we're trying to build.

What I'm trying to show you is that you need to end up with a SQL expression that has the delimited strings in an IN clause -- IN ('211','212') -- and that, while annoying when expressed as above, it is possible to do it <s>. This is because the JOIN function will take the various values for each of the parameter values in the collection and concatenate them with a delimiter that, in this case, is three characters long: ',' .

We add the outside or "embracing" single quote delimiters for the first and last items in the collection manually.

If there is only one item in the dropdown selected, the JOIN doesn't add anything but the one value, and the result is (say) IN ('211'), perfectly valid.

If you find it annoying to look at the SQL this way (I do) you can do what I've advised others to do several times in similar situations: just write a query that looks like this:

=Code.GetSQL()

... and write a little embedded Function GetSQL() AS String in your report, that returns the query as a string. You'll write a more maintainable version of the parsing code if you don't have to do it all in-line as above. If you need to do any type conversions or iterate through the parameter collection for any other reason, it will be easier.

HTH,

>L<

|||

Lisa:

Thank you so much for such an involved reply. I like that answer and feel that you are most likely correct. However, I'm having trouble getting that to work for me.

Is the JOIN function that you are using in your code the one that can be used by right clicking a field on the layout tab of the report and selecting expression?

I'm not sure how I can use that JOIN in the SQL select statement on the Data tab. It doesn't seem to me that the code you have shown can be used in a standard select statement. How would I do that? As far as I know, JOIN in "natural SQL" can be INNER JOIN, OUTER JOIN, etc. However, I've never seen just JOIN used as you have here.

Also you've used the Parameters!RUs.Value syntax here. Shouldn't that be @.RUs as it is the data portion of the report and not the layout of the report?

Mainiac007:

The RUs parameter in my stored procedure is varchar(1000).

The multivalue report parameter is of type String.

The ChartOfAccountsAccountNo is of type varchar(24).

|||

the JOIN she is referring to is not a sql command but a vb function.

|||

HI there,

I'm sorry the reply was involved -- unfortunately it has to be <s>. I've seen a bunch of people saying you can't do this, which is why I bothered to write out the whole thing <s>. And it seems I guessed right about your data types, so you did need the full information.

To answer your question(s), and I promise it really does work <s>.... Look really carefully at the expression I wrote:

I didn't write a SQL statement. I wrote an EXPRESSION which, when evaluated, is a SQL statement.

Notice the = at the beginning. Notice the double quotes -- that's VB expression quotes, not SQL delimiters -- around the parts of the expression.

Notice, also, that I said in my reply that you could do the same thing by using the expression =Code.GetSql(), where GetSql is an embedded function in the Report Code. Obviously the SQL engine wouldn't understand Code.GetSql() either, but that makes no difference <s>.

Either way, in-line expression or function, the *returned result* of the expression is a valid SQL statement, which has been dynamically built up from strings to meet your requirements. The string which has been built up is what is going to get sent to the SQL engine, not the expression that created it.

As for why I used Parameters!RUs.Value rather than @.RUs, I think that will be obvious when you grok what I just said <s>. I'm not talking SQL when I'm creating the string. I'm talking report-scoped object syntax, and I'm talking to the collection of parameter objects that represents your multi-select parameter. The JOIN function is VB, and I'm using it in a way that is entirely appropriate to the problem at hand. (Considering the number of times I have seen people say "you can't do that with string values", I flatter myself that it's a pretty cool idea, too <g>.)

Does this make more sense now?

>L<

|||I could not have said it better myself.|||

>> I could not have said it better myself

gee thanks <rofl> No offense, Maniac007, but ...

you were one of the people who appeared to need help on this exact issue and hence one of the reasons I posted (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1012961&SiteID=1) .

>L<

|||yup, that was LAST year.... since then 6 months of working with ssrs has taught me a lot.|||

Sorry, Mainiac007, I didn't mean you didn't *know* this. I meant it was obviously hard to write out and explain -- otherwise, obviously, you or many other people who post here would have done it <s>.

I've avoided explaining it many times as well, this time I just decided to bite the bullet. Let's hope the explanation is sufficiently clear and that people link to this thread as necessary.

>L<

|||

My wife would kill me for saying this....but,,,,

"Just like a women, to have the last word."

|||

Lisa,

Thank you so much for your help. I think I'm at least following you now, but I still have an error in my SELECT statement and I can't seem to figure out what it is.

The error I get when running the report is: Incorrect syntax near 'GL_TRX'.

|||

what are you summing this as...

SUM(GL_TRX.GLTRXAMOUNT) as what?|||

There are a couple of things that I see...

1. As Mainiac007 has already told you, you probably need an alias on your calculated (SUM(GL_TRX.GLTRXAMOUNT)) field.

2. Remember what I told you about those extra spaces you can't put in? Well, you put them in <g>.

" AND (SUBSTRING(CHART_OF_ACCOUNTS.CHARTOFACCTSACCOUNTNO,9,3) IN (' " &

JOIN(Parameters!RUs.Value," ',' ") & " ') " ...

you need to remove the extra spaces you put in, in all the places I marked in red where you have a single and double quote next to each other. Do you see why? Let's say your parameter value is XYZ. You want the chart of accts substring to match 'XYZ', you don't want it to match SPACE(1) + 'XYZ' + SPACE(1). Or, you could leave the spaces in but then you would have to change your substring expression to delimit with a space on either side.

3. I don't think that, when you're using a dynamically constructed query like this, you should use explicit params the way you're doing it embedded in the strings. It may work in some instances, it doesn't work out too well for me. So, instead of

"GL_TRX.GLTRXDATE BETWEEN @.StartDate AND @.EndDate"

... I would write:

"GL_TRX.GLTRXDATE BETWEEN '" & CSTR(@.StartDate) & "' AND '" & CSTR(@.EndDate) & "' "

... or something like that. Notice I've put the single quotes in red again so you can see them next to the double quotes.

4. I have two suggestions for you that might help you debug and also make the code less messy to maintain:

The first, I've already suggested (put the sql creation into an embedded proc so you can break it up and read what you are doing, append into a StringBuilder or whatever and then return the full statement.ToString() when you're done.)

The second is to create a simple report with the same parameters and have a text box that has the same expression building syntax you're using here. It doesn't matter what the rest of the report looks like, you just want one big textbox so that you can read it. Here's why this is a good idea:

* -- if you have basic VB-syntax problems, you'll know because the report won't be able to parse what you did when you try to preview it

* -- if you don't have a VB-syntax problem, you'll see what you did in the body of the report. You should be able to copy and paste it somewhere else and run it as sql. If it's correct, it will run. If not, you'll be able to see why <g>.

* -- once you get it right, you can move that same expression-building code into the "real" report.

HTH,

>L<

|||

I have just run into a similiar situation. Where I have to pass a parameter (multi value) to a stored procedure.

The sproc use a where filed in(@.Centers) command.

When I select 1 value it works fine, when I select all or more then one, then no data is returned.

It seems the value returned from the MV is one,two,three. etc...

where to accurately pass this it should be 'one',two','three'

a hint on how to get it done this way?

MultiValue Parameter Help

I have passed a list of parameters to a multivalue parameter in a SQL Report.

I can click the drop down and see the list of parameters that were passed.

In my select statement for the report, here is the condition I am using in the where clause.

AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN (@.RUs))

Nothing is returned in the result set if more than one value is passed to the multivalue parameter.

Shouldn't the above conidition have the effect that no matter how many account numbers there are, the last three digits in the account number will be compared to each element in my multivalue parameter and if there is a match, it will be selected on the report.

For example, in the multivalue dropdown list, there are the following values:

211

212

If I pass 211 to the report, data is returned. If I pass 211, 212 to the multivalue parameter no data is returned.

what is the value type for your MV paramater? Is it the same as the sql value type?

|||

>>Shouldn't the above conidition have the effect that no matter how many account numbers there are

You might think so, but no <g>. You have to build the SQL, there's no magic here that allows the SQL to automatically understand a collection of values -- which is what the multiselect parameter is.

I'll assume that your values for the dropdown list are string-type, because that is the hardest case usually and because you're using SUBSTRING() on your data column...

You need to construct your SQL something like this:

="SELECT " & blah blah blah & "WHERE " & blah blah &

" AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN ('" &

JOIN(Parameters!RUs.Value,"','") & "') "

... the use of red in the expression above is just to make sure you can see the single quotes versus the double quotes. I don't want to add spaces between the characters because those spaces would destroy the syntax we're trying to build.

What I'm trying to show you is that you need to end up with a SQL expression that has the delimited strings in an IN clause -- IN ('211','212') -- and that, while annoying when expressed as above, it is possible to do it <s>. This is because the JOIN function will take the various values for each of the parameter values in the collection and concatenate them with a delimiter that, in this case, is three characters long: ',' .

We add the outside or "embracing" single quote delimiters for the first and last items in the collection manually.

If there is only one item in the dropdown selected, the JOIN doesn't add anything but the one value, and the result is (say) IN ('211'), perfectly valid.

If you find it annoying to look at the SQL this way (I do) you can do what I've advised others to do several times in similar situations: just write a query that looks like this:

=Code.GetSQL()

... and write a little embedded Function GetSQL() AS String in your report, that returns the query as a string. You'll write a more maintainable version of the parsing code if you don't have to do it all in-line as above. If you need to do any type conversions or iterate through the parameter collection for any other reason, it will be easier.

HTH,

>L<

|||

Lisa:

Thank you so much for such an involved reply. I like that answer and feel that you are most likely correct. However, I'm having trouble getting that to work for me.

Is the JOIN function that you are using in your code the one that can be used by right clicking a field on the layout tab of the report and selecting expression?

I'm not sure how I can use that JOIN in the SQL select statement on the Data tab. It doesn't seem to me that the code you have shown can be used in a standard select statement. How would I do that? As far as I know, JOIN in "natural SQL" can be INNER JOIN, OUTER JOIN, etc. However, I've never seen just JOIN used as you have here.

Also you've used the Parameters!RUs.Value syntax here. Shouldn't that be @.RUs as it is the data portion of the report and not the layout of the report?

Mainiac007:

The RUs parameter in my stored procedure is varchar(1000).

The multivalue report parameter is of type String.

The ChartOfAccountsAccountNo is of type varchar(24).

|||

the JOIN she is referring to is not a sql command but a vb function.

|||

HI there,

I'm sorry the reply was involved -- unfortunately it has to be <s>. I've seen a bunch of people saying you can't do this, which is why I bothered to write out the whole thing <s>. And it seems I guessed right about your data types, so you did need the full information.

To answer your question(s), and I promise it really does work <s>.... Look really carefully at the expression I wrote:

I didn't write a SQL statement. I wrote an EXPRESSION which, when evaluated, is a SQL statement.

Notice the = at the beginning. Notice the double quotes -- that's VB expression quotes, not SQL delimiters -- around the parts of the expression.

Notice, also, that I said in my reply that you could do the same thing by using the expression =Code.GetSql(), where GetSql is an embedded function in the Report Code. Obviously the SQL engine wouldn't understand Code.GetSql() either, but that makes no difference <s>.

Either way, in-line expression or function, the *returned result* of the expression is a valid SQL statement, which has been dynamically built up from strings to meet your requirements. The string which has been built up is what is going to get sent to the SQL engine, not the expression that created it.

As for why I used Parameters!RUs.Value rather than @.RUs, I think that will be obvious when you grok what I just said <s>. I'm not talking SQL when I'm creating the string. I'm talking report-scoped object syntax, and I'm talking to the collection of parameter objects that represents your multi-select parameter. The JOIN function is VB, and I'm using it in a way that is entirely appropriate to the problem at hand. (Considering the number of times I have seen people say "you can't do that with string values", I flatter myself that it's a pretty cool idea, too <g>.)

Does this make more sense now?

>L<

|||I could not have said it better myself.|||

>> I could not have said it better myself

gee thanks <rofl> No offense, Maniac007, but ...

you were one of the people who appeared to need help on this exact issue and hence one of the reasons I posted (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1012961&SiteID=1) .

>L<

|||yup, that was LAST year.... since then 6 months of working with ssrs has taught me a lot.|||

Sorry, Mainiac007, I didn't mean you didn't *know* this. I meant it was obviously hard to write out and explain -- otherwise, obviously, you or many other people who post here would have done it <s>.

I've avoided explaining it many times as well, this time I just decided to bite the bullet. Let's hope the explanation is sufficiently clear and that people link to this thread as necessary.

>L<

|||

My wife would kill me for saying this....but,,,,

"Just like a women, to have the last word."

|||

Lisa,

Thank you so much for your help. I think I'm at least following you now, but I still have an error in my SELECT statement and I can't seem to figure out what it is.

The error I get when running the report is: Incorrect syntax near 'GL_TRX'.

|||

what are you summing this as...

SUM(GL_TRX.GLTRXAMOUNT) as what?|||

There are a couple of things that I see...

1. As Mainiac007 has already told you, you probably need an alias on your calculated (SUM(GL_TRX.GLTRXAMOUNT)) field.

2. Remember what I told you about those extra spaces you can't put in? Well, you put them in <g>.

" AND (SUBSTRING(CHART_OF_ACCOUNTS.CHARTOFACCTSACCOUNTNO,9,3) IN (' " &

JOIN(Parameters!RUs.Value," ',' ") & " ') " ...

you need to remove the extra spaces you put in, in all the places I marked in red where you have a single and double quote next to each other. Do you see why? Let's say your parameter value is XYZ. You want the chart of accts substring to match 'XYZ', you don't want it to match SPACE(1) + 'XYZ' + SPACE(1). Or, you could leave the spaces in but then you would have to change your substring expression to delimit with a space on either side.

3. I don't think that, when you're using a dynamically constructed query like this, you should use explicit params the way you're doing it embedded in the strings. It may work in some instances, it doesn't work out too well for me. So, instead of

"GL_TRX.GLTRXDATE BETWEEN @.StartDate AND @.EndDate"

... I would write:

"GL_TRX.GLTRXDATE BETWEEN '" & CSTR(@.StartDate) & "' AND '" & CSTR(@.EndDate) & "' "

... or something like that. Notice I've put the single quotes in red again so you can see them next to the double quotes.

4. I have two suggestions for you that might help you debug and also make the code less messy to maintain:

The first, I've already suggested (put the sql creation into an embedded proc so you can break it up and read what you are doing, append into a StringBuilder or whatever and then return the full statement.ToString() when you're done.)

The second is to create a simple report with the same parameters and have a text box that has the same expression building syntax you're using here. It doesn't matter what the rest of the report looks like, you just want one big textbox so that you can read it. Here's why this is a good idea:

* -- if you have basic VB-syntax problems, you'll know because the report won't be able to parse what you did when you try to preview it

* -- if you don't have a VB-syntax problem, you'll see what you did in the body of the report. You should be able to copy and paste it somewhere else and run it as sql. If it's correct, it will run. If not, you'll be able to see why <g>.

* -- once you get it right, you can move that same expression-building code into the "real" report.

HTH,

>L<

|||

I have just run into a similiar situation. Where I have to pass a parameter (multi value) to a stored procedure.

The sproc use a where filed in(@.Centers) command.

When I select 1 value it works fine, when I select all or more then one, then no data is returned.

It seems the value returned from the MV is one,two,three. etc...

where to accurately pass this it should be 'one',two','three'

a hint on how to get it done this way?

MultiValue Parameter Help

I have passed a list of parameters to a multivalue parameter in a SQL Report.

I can click the drop down and see the list of parameters that were passed.

In my select statement for the report, here is the condition I am using in the where clause.

AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN (@.RUs))

Nothing is returned in the result set if more than one value is passed to the multivalue parameter.

Shouldn't the above conidition have the effect that no matter how many account numbers there are, the last three digits in the account number will be compared to each element in my multivalue parameter and if there is a match, it will be selected on the report.

For example, in the multivalue dropdown list, there are the following values:

211

212

If I pass 211 to the report, data is returned. If I pass 211, 212 to the multivalue parameter no data is returned.

what is the value type for your MV paramater? Is it the same as the sql value type?

|||

>>Shouldn't the above conidition have the effect that no matter how many account numbers there are

You might think so, but no <g>. You have to build the SQL, there's no magic here that allows the SQL to automatically understand a collection of values -- which is what the multiselect parameter is.

I'll assume that your values for the dropdown list are string-type, because that is the hardest case usually and because you're using SUBSTRING() on your data column...

You need to construct your SQL something like this:

="SELECT " & blah blah blah & "WHERE " & blah blah &

" AND (SUBSTRING(C.CHARTOFACCTSACCOUNTNO,9,3) IN ('" &

JOIN(Parameters!RUs.Value,"','") & "') "

... the use of red in the expression above is just to make sure you can see the single quotes versus the double quotes. I don't want to add spaces between the characters because those spaces would destroy the syntax we're trying to build.

What I'm trying to show you is that you need to end up with a SQL expression that has the delimited strings in an IN clause -- IN ('211','212') -- and that, while annoying when expressed as above, it is possible to do it <s>. This is because the JOIN function will take the various values for each of the parameter values in the collection and concatenate them with a delimiter that, in this case, is three characters long: ',' .

We add the outside or "embracing" single quote delimiters for the first and last items in the collection manually.

If there is only one item in the dropdown selected, the JOIN doesn't add anything but the one value, and the result is (say) IN ('211'), perfectly valid.

If you find it annoying to look at the SQL this way (I do) you can do what I've advised others to do several times in similar situations: just write a query that looks like this:

=Code.GetSQL()

... and write a little embedded Function GetSQL() AS String in your report, that returns the query as a string. You'll write a more maintainable version of the parsing code if you don't have to do it all in-line as above. If you need to do any type conversions or iterate through the parameter collection for any other reason, it will be easier.

HTH,

>L<

|||

Lisa:

Thank you so much for such an involved reply. I like that answer and feel that you are most likely correct. However, I'm having trouble getting that to work for me.

Is the JOIN function that you are using in your code the one that can be used by right clicking a field on the layout tab of the report and selecting expression?

I'm not sure how I can use that JOIN in the SQL select statement on the Data tab. It doesn't seem to me that the code you have shown can be used in a standard select statement. How would I do that? As far as I know, JOIN in "natural SQL" can be INNER JOIN, OUTER JOIN, etc. However, I've never seen just JOIN used as you have here.

Also you've used the Parameters!RUs.Value syntax here. Shouldn't that be @.RUs as it is the data portion of the report and not the layout of the report?

Mainiac007:

The RUs parameter in my stored procedure is varchar(1000).

The multivalue report parameter is of type String.

The ChartOfAccountsAccountNo is of type varchar(24).

|||

the JOIN she is referring to is not a sql command but a vb function.

|||

HI there,

I'm sorry the reply was involved -- unfortunately it has to be <s>. I've seen a bunch of people saying you can't do this, which is why I bothered to write out the whole thing <s>. And it seems I guessed right about your data types, so you did need the full information.

To answer your question(s), and I promise it really does work <s>.... Look really carefully at the expression I wrote:

I didn't write a SQL statement. I wrote an EXPRESSION which, when evaluated, is a SQL statement.

Notice the = at the beginning. Notice the double quotes -- that's VB expression quotes, not SQL delimiters -- around the parts of the expression.

Notice, also, that I said in my reply that you could do the same thing by using the expression =Code.GetSql(), where GetSql is an embedded function in the Report Code. Obviously the SQL engine wouldn't understand Code.GetSql() either, but that makes no difference <s>.

Either way, in-line expression or function, the *returned result* of the expression is a valid SQL statement, which has been dynamically built up from strings to meet your requirements. The string which has been built up is what is going to get sent to the SQL engine, not the expression that created it.

As for why I used Parameters!RUs.Value rather than @.RUs, I think that will be obvious when you grok what I just said <s>. I'm not talking SQL when I'm creating the string. I'm talking report-scoped object syntax, and I'm talking to the collection of parameter objects that represents your multi-select parameter. The JOIN function is VB, and I'm using it in a way that is entirely appropriate to the problem at hand. (Considering the number of times I have seen people say "you can't do that with string values", I flatter myself that it's a pretty cool idea, too <g>.)

Does this make more sense now?

>L<

|||I could not have said it better myself.|||

>> I could not have said it better myself

gee thanks <rofl> No offense, Maniac007, but ...

you were one of the people who appeared to need help on this exact issue and hence one of the reasons I posted (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1012961&SiteID=1) .

>L<

|||yup, that was LAST year.... since then 6 months of working with ssrs has taught me a lot.|||

Sorry, Mainiac007, I didn't mean you didn't *know* this. I meant it was obviously hard to write out and explain -- otherwise, obviously, you or many other people who post here would have done it <s>.

I've avoided explaining it many times as well, this time I just decided to bite the bullet. Let's hope the explanation is sufficiently clear and that people link to this thread as necessary.

>L<

|||

My wife would kill me for saying this....but,,,,

"Just like a women, to have the last word."

|||

Lisa,

Thank you so much for your help. I think I'm at least following you now, but I still have an error in my SELECT statement and I can't seem to figure out what it is.

The error I get when running the report is: Incorrect syntax near 'GL_TRX'.

|||

what are you summing this as...

SUM(GL_TRX.GLTRXAMOUNT) as what?

|||

There are a couple of things that I see...

1. As Mainiac007 has already told you, you probably need an alias on your calculated (SUM(GL_TRX.GLTRXAMOUNT)) field.

2. Remember what I told you about those extra spaces you can't put in? Well, you put them in <g>.

" AND (SUBSTRING(CHART_OF_ACCOUNTS.CHARTOFACCTSACCOUNTNO,9,3) IN (' " &

JOIN(Parameters!RUs.Value," ',' ") & " ') " ...

you need to remove the extra spaces you put in, in all the places I marked in red where you have a single and double quote next to each other. Do you see why? Let's say your parameter value is XYZ. You want the chart of accts substring to match 'XYZ', you don't want it to match SPACE(1) + 'XYZ' + SPACE(1). Or, you could leave the spaces in but then you would have to change your substring expression to delimit with a space on either side.

3. I don't think that, when you're using a dynamically constructed query like this, you should use explicit params the way you're doing it embedded in the strings. It may work in some instances, it doesn't work out too well for me. So, instead of

"GL_TRX.GLTRXDATE BETWEEN @.StartDate AND @.EndDate"

... I would write:

"GL_TRX.GLTRXDATE BETWEEN '" & CSTR(@.StartDate) & "' AND '" & CSTR(@.EndDate) & "' "

... or something like that. Notice I've put the single quotes in red again so you can see them next to the double quotes.

4. I have two suggestions for you that might help you debug and also make the code less messy to maintain:

The first, I've already suggested (put the sql creation into an embedded proc so you can break it up and read what you are doing, append into a StringBuilder or whatever and then return the full statement.ToString() when you're done.)

The second is to create a simple report with the same parameters and have a text box that has the same expression building syntax you're using here. It doesn't matter what the rest of the report looks like, you just want one big textbox so that you can read it. Here's why this is a good idea:

* -- if you have basic VB-syntax problems, you'll know because the report won't be able to parse what you did when you try to preview it

* -- if you don't have a VB-syntax problem, you'll see what you did in the body of the report. You should be able to copy and paste it somewhere else and run it as sql. If it's correct, it will run. If not, you'll be able to see why <g>.

* -- once you get it right, you can move that same expression-building code into the "real" report.

HTH,

>L<

|||

I have just run into a similiar situation. Where I have to pass a parameter (multi value) to a stored procedure.

The sproc use a where filed in(@.Centers) command.

When I select 1 value it works fine, when I select all or more then one, then no data is returned.

It seems the value returned from the MV is one,two,three. etc...

where to accurately pass this it should be 'one',two','three'

a hint on how to get it done this way?

Wednesday, March 21, 2012

Multiple Values to select all values or deselect all values

I have 3 multi select report parameters on my report. Let's say a
user selects only a few of the values in each of the report parameter
drop downs but know they want to select all of the values with a click
of option button.
Then what I would like to do is have an option button that will allow
the user to select all of the option values or deselect all of the
values for all pararmeters by just selecting True or False from the
option button. Is there a way of doing this in Reporting Services?
Thanks for any help proved!On Jul 20, 11:01 am, trevorfuller1...@.gmail.com wrote:
> I have 3 multi select report parameters on my report. Let's say a
> user selects only a few of the values in each of the report parameter
> drop downs but know they want to select all of the values with a click
> of option button.
> Then what I would like to do is have an option button that will allow
> the user to select all of the option values or deselect all of the
> values for all pararmeters by just selecting True or False from the
> option button. Is there a way of doing this in Reporting Services?
> Thanks for any help proved!
There is not something built in to SSRS already; however, you could
create the functionality. You could have a parameter that if its value
is selected as True, you could send an 'All' type value back to the
stored procedure/query that is sourcing the report and then the stored
procedure could determine what 'All' means and select everything. Hope
this helps.
Regards,
Enrique Martinez
Sr. Software Consultantsql

Wednesday, March 7, 2012

Multiple shared data source

I have a report that uses one data source connection, and the parameter drop
down list requires a different data source connection. After the report is
deployed, I want the report to use shared data source. I can only change to
a single shared data source through the report properties on the Report
Manager screen. Is it possible to use multiple shared data source?
Better yet, can Microsoft make this feature available for the production
release?You should see all data sources in Report Manager assuming your report has
multiple data sets using multiple shared data sources.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Alex Fung" <AlexFung@.discussions.microsoft.com> wrote in message
news:572B623D-725C-4F47-9268-9BB2A24EE32C@.microsoft.com...
>I have a report that uses one data source connection, and the parameter
>drop
> down list requires a different data source connection. After the report
> is
> deployed, I want the report to use shared data source. I can only change
> to
> a single shared data source through the report properties on the Report
> Manager screen. Is it possible to use multiple shared data source?
> Better yet, can Microsoft make this feature available for the production
> release?

Saturday, February 25, 2012

Multiple selects on PArameter drop down

I have a parameter dropdown as USERID.

I want a functionality that the user can selct multiple userid's to show more than one record as output for comparison purpose.

How can i achieve this multiple select (i.e cntrl+click) within parameter dropdown.

Thanks,

Kiran.

In the report parameters window, check the 'Multi-value' box on your UserID parameter. In the available values section, you can type the possible values, or query the database to get the list.

You will also need to take the multiple values into account on your data query, you'll need to use 'IN' instead of '=' on your where clause for UserID.

This will show on the report as a drop down, where the user can check which values to run the report with.

Hope this helps,

Jarret

|||

Thank you Jarret.

I cannot find teh checkbox for 'multi-value'' allowed . I am using reporting services 2000 on visual Studios.NET 2003 SQL Server 2000.

Is this an issue for me only. I have the checkboxes for allow null values and allow blank values for the userid parameter.

thanks.

|||

Sorry, I had assumed that you were running RS 2005. In Reporting Services 2000, a report parameter can only be defined to allow the user to enter a single value.

Jarret

|||

Thanks Jarret,

Is there a wor around that I should be trying.

Appreciate the time.

|||

Hmmm...

You could try changing the parameter type to string and make your data query use 'IN', then have the user type a comma delimited list. I haven't tried it, but you might be able to get it to work.

Jarret

|||Did this work for you?|||

This did not work for me. I shifted to 2005 and implemented it.

Thanks

Multiple selects on PArameter drop down

I have a parameter dropdown as USERID.

I want a functionality that the user can selct multiple userid's to show more than one record as output for comparison purpose.

How can i achieve this multiple select (i.e cntrl+click) within parameter dropdown.

Thanks,

Kiran.

In the report parameters window, check the 'Multi-value' box on your UserID parameter. In the available values section, you can type the possible values, or query the database to get the list.

You will also need to take the multiple values into account on your data query, you'll need to use 'IN' instead of '=' on your where clause for UserID.

This will show on the report as a drop down, where the user can check which values to run the report with.

Hope this helps,

Jarret

|||

Thank you Jarret.

I cannot find teh checkbox for 'multi-value'' allowed . I am using reporting services 2000 on visual Studios.NET 2003 SQL Server 2000.

Is this an issue for me only. I have the checkboxes for allow null values and allow blank values for the userid parameter.

thanks.

|||

Sorry, I had assumed that you were running RS 2005. In Reporting Services 2000, a report parameter can only be defined to allow the user to enter a single value.

Jarret

|||

Thanks Jarret,

Is there a wor around that I should be trying.

Appreciate the time.

|||

Hmmm...

You could try changing the parameter type to string and make your data query use 'IN', then have the user type a comma delimited list. I haven't tried it, but you might be able to get it to work.

Jarret

|||Did this work for you?|||

This did not work for me. I shifted to 2005 and implemented it.

Thanks

Multiple selects on PArameter drop down

I have a parameter dropdown as USERID.

I want a functionality that the user can selct multiple userid's to show more than one record as output for comparison purpose.

How can i achieve this multiple select (i.e cntrl+click) within parameter dropdown.

Thanks,

Kiran.

In the report parameters window, check the 'Multi-value' box on your UserID parameter. In the available values section, you can type the possible values, or query the database to get the list.

You will also need to take the multiple values into account on your data query, you'll need to use 'IN' instead of '=' on your where clause for UserID.

This will show on the report as a drop down, where the user can check which values to run the report with.

Hope this helps,

Jarret

|||

Thank you Jarret.

I cannot find teh checkbox for 'multi-value'' allowed . I am using reporting services 2000 on visual Studios.NET 2003 SQL Server 2000.

Is this an issue for me only. I have the checkboxes for allow null values and allow blank values for the userid parameter.

thanks.

|||

Sorry, I had assumed that you were running RS 2005. In Reporting Services 2000, a report parameter can only be defined to allow the user to enter a single value.

Jarret

|||

Thanks Jarret,

Is there a wor around that I should be trying.

Appreciate the time.

|||

Hmmm...

You could try changing the parameter type to string and make your data query use 'IN', then have the user type a comma delimited list. I haven't tried it, but you might be able to get it to work.

Jarret

|||Did this work for you?|||

This did not work for me. I shifted to 2005 and implemented it.

Thanks

multiple select in the parameter field in Crystal reports 8.5

I have a multiple select in the parameter field in Crystal reports 8.5 how do i check against that value in my SP?

Suppose I select 2 user from Drop down say

Mary
John

Are they comma seperated the way they r in Web based apps?
how do i build a SQL String based on the User criteria?Where is the dropdown - in Crystal (as a defined range of inputs) or in an application devloped from Vb or C++ or similar?
To use the VB example, when you populate a combo box, you can assign a value to the .ItemData property of the combo, and then return that to the report via the .ParameterFields collection exposed via the CR Active X control.
Say you populate your combo with data from a table:
RecordID Name
1 Fred
2 Mary
3 Joan
4 John
etc

then in VB code would be
...open recordset
...start looping thru records
cboTest.AddItem value_to_appear ' eg Fred
cboTest.ItemData(cboTest.NewIndex) = id 'eg 1
next

when you click on the combo, you can get the index and pass it to crystal
lngID = cboTest.ItemData(cboTest.ListIndex)

then in your code you can pass that to report when you open it, eg
Dim objPrintApp As CRAXDRT.Application
Dim objReport As CRAXDRT.Report
Dim objParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim objParamDef As CRAXDRT.ParameterFieldDefinition

' code presumes you have an input parameter to your report named pID
' Set the report source
Set objPrintApp = New CRAXDRT.Application
Set objReport = objPrintApp.OpenReport(strReportSourcePath & strSource)
objPrintApp.LogOnServerEx put logon parameters here

Set objParamDefs = objReport.ParameterFields
For Each objParamDef In objParamDefs
With objParamDef
Select Case .ParameterFieldName
'It finds and sets the appropriate Crystal parameters.
Case "pID"
.SetCurrentValue lngID

' add other Case conditions here to handle other parameter names.

' Catch-all for others
Case Else
strInput = InputBox("Enter a value for '" & .ParameterFieldName & "'")
If strInput <> "" Then
.SetCurrentValue strInput
Else
Exit Sub
End If
End Select
End With
Next

objReport.PrintOut

hope this helps

dave|||Thks for ur prompt reply...but the drop down is in crystal reports 8.5

I am using Crystal reports 8.5 stand alone with enterprise server......i mean i not using VB or anything else as App dev.
I have SP in SQL server 2000

I need to select multiple values from the drop down of the parameter field.
how do I put those values in the drop down of the parameter field which needs to be passed to the SP?

How do I build the Sql query once the multiple values r selected? are the multiple values comma seperated??

Multiple select in 2005 Beta 2

I have heard that the ability to do multi-selects (selecting multiple records
in a drop down prompt) would be possible in the 2005 version of ssas. I have
the Beta 2 version and still do not think it is possible. Any help would be
greatly appreciated.Multi-value parameters are not supported in Beta 2.
--
Rajeev Karunakaran [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"chicagoclone" <chicagoclone@.discussions.microsoft.com> wrote in message
news:10D5F583-946B-4A2D-8079-8F711114B2C2@.microsoft.com...
>I have heard that the ability to do multi-selects (selecting multiple
>records
> in a drop down prompt) would be possible in the 2005 version of ssas. I
> have
> the Beta 2 version and still do not think it is possible. Any help would
> be
> greatly appreciated.|||Is this something that is PLANNED for the general release?
"Rajeev Karunakaran [MSFT]" wrote:
> Multi-value parameters are not supported in Beta 2.
> --
> Rajeev Karunakaran [MSFT]
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "chicagoclone" <chicagoclone@.discussions.microsoft.com> wrote in message
> news:10D5F583-946B-4A2D-8079-8F711114B2C2@.microsoft.com...
> >I have heard that the ability to do multi-selects (selecting multiple
> >records
> > in a drop down prompt) would be possible in the 2005 version of ssas. I
> > have
> > the Beta 2 version and still do not think it is possible. Any help would
> > be
> > greatly appreciated.
>
>