Shouldn't the last value be Parameters!Para1.Value instead of Para1.Value... -- Wayne Snyder MCDBA, SQL Server MVP Mariner, Charlotte, NC I support the Professional Association for SQL Server ( PASS) and it''s community of SQL Professionals. [quoted text, click to view] "Ralph Watermann" wrote: > Hi, > > we try to pass a parameter to a "universal" assembly function but do not > know in advance if the parameter is multivalue or not. So we tried the > following: (the function returns an MDX-query-String to retrieve the > dataset): > > =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, > Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) > > If Para1 ist multivalue, everything works fine. But if not, we have to call > =Assembly.Function( Para1.Value ) > > or otherwise we get an error. > > What do we wrong? > >
I think this would work: =Assembly.Function( IIF(Parameters!Para1.Count > 1, Join(Parameters!Para1.Value, ", ", Paramters!Para1.Value(0)) ) ) -- Bruce Loehle-Conger MVP SQL Server Reporting Services [quoted text, click to view] "Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> wrote in message news:022C8C15-1E04-445F-9F38-778A2017AD2B@microsoft.com... > Shouldn't the last value be Parameters!Para1.Value instead of > Para1.Value... > > > -- > Wayne Snyder MCDBA, SQL Server MVP > Mariner, Charlotte, NC > > I support the Professional Association for SQL Server ( PASS) and it''s > community of SQL Professionals. > > > "Ralph Watermann" wrote: > >> Hi, >> >> we try to pass a parameter to a "universal" assembly function but do not >> know in advance if the parameter is multivalue or not. So we tried the >> following: (the function returns an MDX-query-String to retrieve the >> dataset): >> >> =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, >> Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) >> >> If Para1 ist multivalue, everything works fine. But if not, we have to >> call >> =Assembly.Function( Para1.Value ) >> >> or otherwise we get an error. >> >> What do we wrong? >> >> >>
Hi, we try to pass a parameter to a "universal" assembly function but do not know in advance if the parameter is multivalue or not. So we tried the following: (the function returns an MDX-query-String to retrieve the dataset): =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) If Para1 ist multivalue, everything works fine. But if not, we have to call =Assembly.Function( Para1.Value ) or otherwise we get an error. What do we wrong?
Write code behind to do this for you. That is the general solution to deal with both sides of an iif being evaluated (have same problem with divide by 0 type of problem). -- Bruce Loehle-Conger MVP SQL Server Reporting Services [quoted text, click to view] "Ralph Watermann" <We.Want@NoSpam.de> wrote in message news:OWORBD17FHA.2616@TK2MSFTNGP15.phx.gbl... >I couldn't get your suggestion to work, so I tried: > > =IIF(TypeOf Parameters!TestSingleOrMulti.Value IS ARRAY, > JOIN(Parameters!TestSingleOrMulti.Value, ", "), > Parameters!TestSingleOrMulti.Value) > > But this fails, too. > > To make it more clear: We have to decide at runtime, if a parameter is > multi-value or not. And not if there is only one entry in a multi-value > parameter! The IS ARRAY-statement ( or IS STRING) statement works correct, > but both parts of the above if-statement seem to be evaluated, and one if > them of course has to fail... > > "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag > news:e$K1jbg6FHA.3880@TK2MSFTNGP12.phx.gbl... >>I think this would work: >> >> =Assembly.Function( IIF(Parameters!Para1.Count > 1, >> Join(Parameters!Para1.Value, ", ", Paramters!Para1.Value(0)) ) ) >> >> >> -- >> Bruce Loehle-Conger >> MVP SQL Server Reporting Services >> >> "Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> wrote in message >> news:022C8C15-1E04-445F-9F38-778A2017AD2B@microsoft.com... >>> Shouldn't the last value be Parameters!Para1.Value instead of >>> Para1.Value... >>> >>> >>> -- >>> Wayne Snyder MCDBA, SQL Server MVP >>> Mariner, Charlotte, NC >>> >>> I support the Professional Association for SQL Server ( PASS) and it''s >>> community of SQL Professionals. >>> >>> >>> "Ralph Watermann" wrote: >>> >>>> Hi, >>>> >>>> we try to pass a parameter to a "universal" assembly function but do >>>> not >>>> know in advance if the parameter is multivalue or not. So we tried the >>>> following: (the function returns an MDX-query-String to retrieve the >>>> dataset): >>>> >>>> =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, >>>> Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) >>>> >>>> If Para1 ist multivalue, everything works fine. But if not, we have to >>>> call >>>> =Assembly.Function( Para1.Value ) >>>> >>>> or otherwise we get an error. >>>> >>>> What do we wrong? >>>> >>>> >>>> >> >> > >
I couldn't get your suggestion to work, so I tried: =IIF(TypeOf Parameters!TestSingleOrMulti.Value IS ARRAY, JOIN(Parameters!TestSingleOrMulti.Value, ", "), Parameters!TestSingleOrMulti.Value) But this fails, too. To make it more clear: We have to decide at runtime, if a parameter is multi-value or not. And not if there is only one entry in a multi-value parameter! The IS ARRAY-statement ( or IS STRING) statement works correct, but both parts of the above if-statement seem to be evaluated, and one if them of course has to fail... "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag news:e$K1jbg6FHA.3880@TK2MSFTNGP12.phx.gbl... [quoted text, click to view] >I think this would work: > > =Assembly.Function( IIF(Parameters!Para1.Count > 1, > Join(Parameters!Para1.Value, ", ", Paramters!Para1.Value(0)) ) ) > > > -- > Bruce Loehle-Conger > MVP SQL Server Reporting Services > > "Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> wrote in message > news:022C8C15-1E04-445F-9F38-778A2017AD2B@microsoft.com... >> Shouldn't the last value be Parameters!Para1.Value instead of >> Para1.Value... >> >> >> -- >> Wayne Snyder MCDBA, SQL Server MVP >> Mariner, Charlotte, NC >> >> I support the Professional Association for SQL Server ( PASS) and it''s >> community of SQL Professionals. >> >> >> "Ralph Watermann" wrote: >> >>> Hi, >>> >>> we try to pass a parameter to a "universal" assembly function but do not >>> know in advance if the parameter is multivalue or not. So we tried the >>> following: (the function returns an MDX-query-String to retrieve the >>> dataset): >>> >>> =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, >>> Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) >>> >>> If Para1 ist multivalue, everything works fine. But if not, we have to >>> call >>> =Assembly.Function( Para1.Value ) >>> >>> or otherwise we get an error. >>> >>> What do we wrong? >>> >>> >>> > >
You pass it Parameters!Para.Value and your code returns whatever is appropriate. In code you can use if then logic and only the appropriate logic will be executed. -- Bruce Loehle-Conger MVP SQL Server Reporting Services [quoted text, click to view] "Ralph Watermann" <We.Want@NoSpam.de> wrote in message news:uZRkMiB8FHA.1184@TK2MSFTNGP12.phx.gbl... > Hmm, I'm no expert in VB.NET, but my problem is that if I use code behind > I have to pass the value of EITHER Parameters!Para.Value OR > JOIN(Parameters!Para.Value,", ") to my code behind and decide this AT > RUNTIME (!) > And this seems to me the same problem. I'm not able to see the solution in > your suggestion. > > > "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag > news:eLOrxj47FHA.3200@TK2MSFTNGP11.phx.gbl... >> Write code behind to do this for you. That is the general solution to >> deal with both sides of an iif being evaluated (have same problem with >> divide by 0 type of problem). >> >> >> -- >> Bruce Loehle-Conger >> MVP SQL Server Reporting Services >> >> "Ralph Watermann" <We.Want@NoSpam.de> wrote in message >> news:OWORBD17FHA.2616@TK2MSFTNGP15.phx.gbl... >>>I couldn't get your suggestion to work, so I tried: >>> >>> =IIF(TypeOf Parameters!TestSingleOrMulti.Value IS ARRAY, >>> JOIN(Parameters!TestSingleOrMulti.Value, ", "), >>> Parameters!TestSingleOrMulti.Value) >>> >>> But this fails, too. >>> >>> To make it more clear: We have to decide at runtime, if a parameter is >>> multi-value or not. And not if there is only one entry in a multi-value >>> parameter! The IS ARRAY-statement ( or IS STRING) statement works >>> correct, but both parts of the above if-statement seem to be evaluated, >>> and one if them of course has to fail... >>> >>> "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag >>> news:e$K1jbg6FHA.3880@TK2MSFTNGP12.phx.gbl... >>>>I think this would work: >>>> >>>> =Assembly.Function( IIF(Parameters!Para1.Count > 1, >>>> Join(Parameters!Para1.Value, ", ", Paramters!Para1.Value(0)) ) ) >>>> >>>> >>>> -- >>>> Bruce Loehle-Conger >>>> MVP SQL Server Reporting Services >>>> >>>> "Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> wrote in message >>>> news:022C8C15-1E04-445F-9F38-778A2017AD2B@microsoft.com... >>>>> Shouldn't the last value be Parameters!Para1.Value instead of >>>>> Para1.Value... >>>>> >>>>> >>>>> -- >>>>> Wayne Snyder MCDBA, SQL Server MVP >>>>> Mariner, Charlotte, NC >>>>> >>>>> I support the Professional Association for SQL Server ( PASS) and >>>>> it''s >>>>> community of SQL Professionals. >>>>> >>>>> >>>>> "Ralph Watermann" wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> we try to pass a parameter to a "universal" assembly function but do >>>>>> not >>>>>> know in advance if the parameter is multivalue or not. So we tried >>>>>> the >>>>>> following: (the function returns an MDX-query-String to retrieve the >>>>>> dataset): >>>>>> >>>>>> =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, >>>>>> Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) >>>>>> >>>>>> If Para1 ist multivalue, everything works fine. But if not, we have >>>>>> to call >>>>>> =Assembly.Function( Para1.Value ) >>>>>> >>>>>> or otherwise we get an error. >>>>>> >>>>>> What do we wrong? >>>>>> >>>>>> >>>>>> >>>> >>>> >>> >>> >> >> > >
Hmm, I'm no expert in VB.NET, but my problem is that if I use code behind I have to pass the value of EITHER Parameters!Para.Value OR JOIN(Parameters!Para.Value,", ") to my code behind and decide this AT RUNTIME (!) And this seems to me the same problem. I'm not able to see the solution in your suggestion. "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag news:eLOrxj47FHA.3200@TK2MSFTNGP11.phx.gbl... [quoted text, click to view] > Write code behind to do this for you. That is the general solution to deal > with both sides of an iif being evaluated (have same problem with divide > by 0 type of problem). > > > -- > Bruce Loehle-Conger > MVP SQL Server Reporting Services > > "Ralph Watermann" <We.Want@NoSpam.de> wrote in message > news:OWORBD17FHA.2616@TK2MSFTNGP15.phx.gbl... >>I couldn't get your suggestion to work, so I tried: >> >> =IIF(TypeOf Parameters!TestSingleOrMulti.Value IS ARRAY, >> JOIN(Parameters!TestSingleOrMulti.Value, ", "), >> Parameters!TestSingleOrMulti.Value) >> >> But this fails, too. >> >> To make it more clear: We have to decide at runtime, if a parameter is >> multi-value or not. And not if there is only one entry in a multi-value >> parameter! The IS ARRAY-statement ( or IS STRING) statement works >> correct, but both parts of the above if-statement seem to be evaluated, >> and one if them of course has to fail... >> >> "Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schrieb im Newsbeitrag >> news:e$K1jbg6FHA.3880@TK2MSFTNGP12.phx.gbl... >>>I think this would work: >>> >>> =Assembly.Function( IIF(Parameters!Para1.Count > 1, >>> Join(Parameters!Para1.Value, ", ", Paramters!Para1.Value(0)) ) ) >>> >>> >>> -- >>> Bruce Loehle-Conger >>> MVP SQL Server Reporting Services >>> >>> "Wayne Snyder" <wayne.nospam.snyder@mariner-usa.com> wrote in message >>> news:022C8C15-1E04-445F-9F38-778A2017AD2B@microsoft.com... >>>> Shouldn't the last value be Parameters!Para1.Value instead of >>>> Para1.Value... >>>> >>>> >>>> -- >>>> Wayne Snyder MCDBA, SQL Server MVP >>>> Mariner, Charlotte, NC >>>> >>>> I support the Professional Association for SQL Server ( PASS) and it''s >>>> community of SQL Professionals. >>>> >>>> >>>> "Ralph Watermann" wrote: >>>> >>>>> Hi, >>>>> >>>>> we try to pass a parameter to a "universal" assembly function but do >>>>> not >>>>> know in advance if the parameter is multivalue or not. So we tried the >>>>> following: (the function returns an MDX-query-String to retrieve the >>>>> dataset): >>>>> >>>>> =Assembly.Function( IIF(Parameters!Para1.IsMultiValue, >>>>> Join(Parameters!Para1.Value, ", ", Para1.Value) ) ) >>>>> >>>>> If Para1 ist multivalue, everything works fine. But if not, we have to >>>>> call >>>>> =Assembly.Function( Para1.Value ) >>>>> >>>>> or otherwise we get an error. >>>>> >>>>> What do we wrong? >>>>> >>>>> >>>>> >>> >>> >> >> > >
Don't see what you're looking for? Try a search.
|