Showing posts with label certain. Show all posts
Showing posts with label certain. Show all posts

Wednesday, March 21, 2012

Errors while browsing the cube - "#Value"

While browsing the cube, I'm getting a "#Value" error, which I believe is due to the non existence of certain attribute members.

For example, working on Adventure Works database. Assuming there is no Product Category = 5 in the SSAS database but we want to add this category into the calculation for future purposes, so the calculation would be as follows

(Measures.[Internet Sales Amount], [Product].[Category].&[5])

This calculation gives me a "#Value" error while browsing, to handle this kind of situation, I added an exception handling, check whether the member exist, if not return 0.

IIF(

ISEMPTY(EXISTS([Product].[Category].[Category].MEMBERS, [Product].[Category].&[5]).ITEM(0)),

0,

Measures.[Internet Sales Amount], [Product].[Category].&[5]

)

This seems to work fine in the SQL Managemen Studio, but when added to the Cube in the Calculations and processes, still I get the same "#Value" error.

Is the apporach to handle this is right? Is there a different way to handle this?

-

Vivek

Doing the whole "IIF( ISEMPTY( EXISTS(...)))" is going to wreck your performance. I'm surprised that it appears to work in SSMS as the EXISTS function will attempt to resolve both the sets in order to evaluate them and should throw an exception trying to resolve [Product[.[Category].&[5] and IsEmpty is not checking if the set is empty, but rather it will be doing a value comparison against the default measure which could lead to misleading results.

There are better ways to code a check like this, but they are still not a good idea. If you know you are going to have a Category 5, add that row to the dimension now and re-process the dimension, even though you don't yet have any facts for it. This way this script will be able to resolve the member reference and everything will work.

Adding references in the script to non-existant members and trying to trap errors is generally a bad thing.

NOTE: in SSMS you can hover over or double click on the #Value to see the text of the error message.

|||

Thanks for the reply.

I guess you are right, I further did a search on this and go the same inputs.

Books Online suggested to use "IS" instead of "ISEMPTY()" to check for emptiness of dimension/attribute members. Even this works in SSMS (MDX query) and when ported to BIDS and browse fails.

You did say there are ways to handle this kind of exception, can you share them? I know it is performance intensive, but I have to catch such kind of exception.

-

Vivek

|||

Just to be entirely clear - you ONLY ever need this sort of check if you are taking user input for something like a parameter in SSRS or some other reporting engine. You should NEVER use the following type of code in your MDX Script.

The pattern in something like an SSRS report would look like the following, passing in the unique name as a string and using the StrToMember() function and testing with the IS operator.

eg.

IIF( StrToMember( @.parameter ) IS NULL, ...

I know I am repeating myself, but I need to make sure this is clear - if you know that you are going to need a product category 5, then create it in the dimension member now. Never put references in your MDX script to members that do not yet exist and then try to wrap these references with code to handle the errors.

If you have a calc that works in SSMS, but not in BIDS, it will be because of the way the browser control in BIDS is structuring the query. Start up a profiler session and capture the queries that BIDS generates and test them in SSMS. There will probably be multiple commands fired off as BIDS quite often uses things like session scoped sets in it's queries.

|||

Darren,

Thanks. Surely will not use this in BIDS, as it clearly doesn't work.

--

Vivek

Errors while browsing the cube - "#Value"

While browsing the cube, I'm getting a "#Value" error, which I believe is due to the non existence of certain attribute members.

For example, working on Adventure Works database. Assuming there is no Product Category = 5 in the SSAS database but we want to add this category into the calculation for future purposes, so the calculation would be as follows

(Measures.[Internet Sales Amount], [Product].[Category].&[5])

This calculation gives me a "#Value" error while browsing, to handle this kind of situation, I added an exception handling, check whether the member exist, if not return 0.

IIF(

ISEMPTY(EXISTS([Product].[Category].[Category].MEMBERS, [Product].[Category].&[5]).ITEM(0)),

0,

Measures.[Internet Sales Amount], [Product].[Category].&[5]

)

This seems to work fine in the SQL Managemen Studio, but when added to the Cube in the Calculations and processes, still I get the same "#Value" error.

Is the apporach to handle this is right? Is there a different way to handle this?

-

Vivek

Doing the whole "IIF( ISEMPTY( EXISTS(...)))" is going to wreck your performance. I'm surprised that it appears to work in SSMS as the EXISTS function will attempt to resolve both the sets in order to evaluate them and should throw an exception trying to resolve [Product[.[Category].&[5] and IsEmpty is not checking if the set is empty, but rather it will be doing a value comparison against the default measure which could lead to misleading results.

There are better ways to code a check like this, but they are still not a good idea. If you know you are going to have a Category 5, add that row to the dimension now and re-process the dimension, even though you don't yet have any facts for it. This way this script will be able to resolve the member reference and everything will work.

Adding references in the script to non-existant members and trying to trap errors is generally a bad thing.

NOTE: in SSMS you can hover over or double click on the #Value to see the text of the error message.

|||

Thanks for the reply.

I guess you are right, I further did a search on this and go the same inputs.

Books Online suggested to use "IS" instead of "ISEMPTY()" to check for emptiness of dimension/attribute members. Even this works in SSMS (MDX query) and when ported to BIDS and browse fails.

You did say there are ways to handle this kind of exception, can you share them? I know it is performance intensive, but I have to catch such kind of exception.

-

Vivek

|||

Just to be entirely clear - you ONLY ever need this sort of check if you are taking user input for something like a parameter in SSRS or some other reporting engine. You should NEVER use the following type of code in your MDX Script.

The pattern in something like an SSRS report would look like the following, passing in the unique name as a string and using the StrToMember() function and testing with the IS operator.

eg.

IIF( StrToMember( @.parameter ) IS NULL, ...

I know I am repeating myself, but I need to make sure this is clear - if you know that you are going to need a product category 5, then create it in the dimension member now. Never put references in your MDX script to members that do not yet exist and then try to wrap these references with code to handle the errors.

If you have a calc that works in SSMS, but not in BIDS, it will be because of the way the browser control in BIDS is structuring the query. Start up a profiler session and capture the queries that BIDS generates and test them in SSMS. There will probably be multiple commands fired off as BIDS quite often uses things like session scoped sets in it's queries.

|||

Darren,

Thanks. Surely will not use this in BIDS, as it clearly doesn't work.

--

Vivek

sql

Sunday, February 19, 2012

Error: The MDX function ROOT failed because...

I'm having problem calculating sales for all customer minus certain occupations.

This Adventureworks query is something like what Excel 2003 produces.

Code Snippet

WITH MEMBER [Customer].[Occupation].[Exclude Occupations] AS

'AGGREGATE({

[Customer].[Occupation].&[Clerical],

[Customer].[Occupation].&[Management]

})'

MEMBER Measures.[Other Occupation Sales] as (ROOT(Customer), [Measures].[Internet Sales Amount]) - [Measures].[Internet Sales Amount]

SELECT

{Measures.[Other Occupation Sales]} ON COLUMNS,

[Product].[Category].[Category].MEMBERS ON ROWS

FROM [Adventure Works]

WHERE

([Customer].[Occupation].[Exclude Occupations])

Error: The MDX function ROOT failed because the coordinate for the 'Occupation' attribute contains a set.

If you delete this line, the query works!

[Customer].[Occupation].&[Clerical],

Does anyone know what this means? Is there another way to get Excel to formulate an equivalent query?

The problem is because there is a set in the current coordinate, and Root has problem dealing with it (although it shouldn't!). The best solution is to replace Root(Customer) with [All Customers] - which will have exactly same functionality, better performance, and won't generate the error that started this thread.|||

Yes, I replaced Root(Customer) with [Customer].[Occupation].[All Customers] and it works. The problem is that I wanted to create a general purpose calculated measure that would override every attribute in the customer dimension with "All". I thought Root did precisely that. If I can't use Root() then I will need to remember to update this calculation every time an attribute is added or removed from the customer dimension.

Thanks for the input.

|||

> The problem is that I wanted to create a general purpose calculated measure that would override every attribute in the customer dimension with "All"

[All Customers] does exactly that ! There is no need to update your calculation every time new attribute is added, [All Customers] (in any hierarchy of customers dimension) will automatically move coordinate to All member in every attribute.

|||

Try my AdventureWorks repro with [All Customers] instead of Root(). It doesn't work. It doesn't replace the aggregate set of occupations with the All tuple. I end up with zeros in the results because [All Customers] is doing absolutely nothing for me.

The only way I got it to work was with [Customer].[Occupation].[All Customers]. This member does, in fact, replace my aggregate set of occupations.

Put that in your pipe and smoke it!

I'm curious how [All Customers] is defined to work (vs. Root()).

|||Of course - you are right. I don't know what I was thinking. What I said is only true when dimension has single hierarchy which includes all attributes, which is obviously not the case for most of the dimensions, especially Customer.|||Thanks for the help. At least I have a work-around for now. It would be nice if Root(dimension) did the same thing as change coordinates to [All Customers] on every attribute. Maybe in the next version...

Wednesday, February 15, 2012

Error: StringStartsWith can't accept null parameters

Hi,
I wish to edit security on a certain report that has been published on my report
server. I visit the "Properties" tab in Report Manager, then click on "Security".
I click on "Edit Item Security" and click through the javascript popup about
inheritance. Then I get a page which says simply, "Error - StringStartsWith can't
accept null parameters".
Has anyone encountered this error? I have no clue how to proceed with debugging,
since I can't even find the code that's throwing this error, nor do I know to
which parameter it's trying to apply StringStartsWith.
Any help would be appreciated.
--Adam BlissPlease, tell us which version of Reporting Service you are using. Also
please provide stack trace for this failure. You should be able to locate it
in one of the log files. Log files are located in the LogFiles directory in
Reporting Services. Look at ones like
ReportServer__07_08_2004_##_##_##.log
and
ReportServerWebApp__07_08_2004_##_##_##.log
Look inside appropriate files and search for string 'StringStartsWith'.
Attach about 50 lines around it.
Thank you.
--
Dmitry Vasilevsky, SQL Server Reporting Services Developer
This posting is provided "AS IS" with no warranties, and confers no rights.
--
---
"Adam Bliss" <abliss@.gmail.com> wrote in message
news:c52bcaf.0407081034.6f9bd2a2@.posting.google.com...
> Hi,
> I wish to edit security on a certain report that has been published on my
report
> server. I visit the "Properties" tab in Report Manager, then click on
"Security".
> I click on "Edit Item Security" and click through the javascript popup
about
> inheritance. Then I get a page which says simply, "Error -
StringStartsWith can't
> accept null parameters".
> Has anyone encountered this error? I have no clue how to proceed with
debugging,
> since I can't even find the code that's throwing this error, nor do I know
to
> which parameter it's trying to apply StringStartsWith.
> Any help would be appreciated.
> --Adam Bliss|||Has anyone solved this?
I am hitting this error when using the Sample Security Extension supplied by M$. Eventviewer tells me that Report server could not load the forms extension.
w3wp!ui!1!9/6/2006-09:09:40:: e ERROR: StringStartsWith can't accept null parameters
w3wp!ui!1!9/6/2006-09:09:40:: e ERROR: HTTP status code --> 500
--Details--
System.ArgumentException: StringStartsWith can't accept null parameters
at Microsoft.SqlServer.ReportingServices2005.RSConnection.GetSecureMethods()
at Microsoft.ReportingServices.UI.Global.RSWebServiceWrapper.GetSecureMethods()
at Microsoft.SqlServer.ReportingServices2005.RSConnection.IsSecureMethod(String methodname)
at Microsoft.SqlServer.ReportingServices2005.RSConnection.ValidateConnection()
at Microsoft.ReportingServices.UI.ReportingPage.EnsureHttpsLevel(HttpsLevel level)
at Microsoft.ReportingServices.UI.ReportingPage.ReportingPage_Init(Object sender, EventArgs args)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Page.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
w3wp!ui!1!9/6/2006-09:09:41:: e ERROR: Exception in ShowErrorPage: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg) at at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg)
Thanks,
Zac
From http://www.developmentnow.com/g/115_2004_7_0_0_448611/Error-StringStartsWith-cant-accept-null-parameters.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com|||Did you get this resolved? I'm getting exactly the same error message in different circumstances..
From http://www.developmentnow.com/g/115_2004_7_0_0_448611/Error-StringStartsWith-cant-accept-null-parameters.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com|||Got this error when trying to make RS work with forms authentication overr SSL. Though i can browse ReportServer folder, trying to access Reports virtual directory brings this error up.
Anyone has solved this issue
From http://developmentnow.com/g/115_2004_7_0_0_448611/Error-StringStartsWith-cant-accept-null-parameters.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com|||Hi
I'm also getting a very similar error. Any solutions for the same?
Any help would be appreciated
From http://www.developmentnow.com/g/115_2004_7_0_0_448611/Error-StringStartsWith-cant-accept-null-parameters.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com