dbTalk Databases Forums  

Problem with SETTOSTR MDX function

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Problem with SETTOSTR MDX function in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alex
 
Posts: n/a

Default Problem with SETTOSTR MDX function - 10-18-2004 , 10:37 AM






I'm studying the dynamic secuity webcast and implemented it in my cube model.
After doing some tests, I've noticed that the code used to restrict the
dimensions levels was going in error.
The code is the following
STRTOSET(IIF(USERNAME="","{}",SETTOSTR(
NONEMPTYCROSSJOIN([Struttura].[UP].members,
{STRTOMEMBER("[DIM_USER].[All DIM_USER].[" + USERNAME + "]")},1)))) on rows
I've began to do the tests using the MDX Sample application, and I tried the
same code, but not using the SETTOSTR and STRTOSET functions (these functions
are necessary because the IIF functions needs it).
And all things worked fine.
My dimension Struttura has about 15.000 members and I begin to suspect that
the function STRTOSET would have some limitation.
I did sample tests with DB Foodmart and noticed the same problems.
The following MDX codes are useful to reproduce the problem :
Code (very simple, show all customers members) that works fine :

select
{ [Measures].[Unit Sales] } on columns,
{customers.[Name].members}
on rows
from Sales

Code with Error (in teory is the same, first I try to convert to str a set
and after reconvert the str to a set):

select
{ [Measures].[Unit Sales] } on columns,
strtoset(settostr({customers.[Name].members}))
on rows
from Sales
The error is something like :
"Unable to open cellset ... Token is not valid .... '[Customers]. .....
,^,^,,,,,,,,, }"

My question is if it is a bug or a limitation of the string size that the
function returns ?

Thanks for the help.

Alex


Reply With Quote
  #2  
Old   
Chris Webb
 
Posts: n/a

Default RE: Problem with SETTOSTR MDX function - 10-18-2004 , 11:15 AM






Alex,

I'm almost certain that you're right, and that the issue is that there is a
maximum length for the string that STRTOSET uses. I'm sure it was discussed
on this ng a while ago, but unfortunately I can't find the thread...

You should be able to work around this problem though. If you create a dummy
user on your user dimension with no access rights, then something like the
following should work:

NONEMPTYCROSSJOIN([Struttura].[UP].members,
{STRTOMEMBER(
IIF(USERNAME="","[DIM_USER].[All DIM_USER].[noaccess]",
"[DIM_USER].[All DIM_USER].[" + USERNAME + "]")
)},1)

HTH,

Chris



Since

"Alex" wrote:

Quote:
I'm studying the dynamic secuity webcast and implemented it in my cube model.
After doing some tests, I've noticed that the code used to restrict the
dimensions levels was going in error.
The code is the following
STRTOSET(IIF(USERNAME="","{}",SETTOSTR(
NONEMPTYCROSSJOIN([Struttura].[UP].members,
{STRTOMEMBER("[DIM_USER].[All DIM_USER].[" + USERNAME + "]")},1)))) on rows
I've began to do the tests using the MDX Sample application, and I tried the
same code, but not using the SETTOSTR and STRTOSET functions (these functions
are necessary because the IIF functions needs it).
And all things worked fine.
My dimension Struttura has about 15.000 members and I begin to suspect that
the function STRTOSET would have some limitation.
I did sample tests with DB Foodmart and noticed the same problems.
The following MDX codes are useful to reproduce the problem :
Code (very simple, show all customers members) that works fine :

select
{ [Measures].[Unit Sales] } on columns,
{customers.[Name].members}
on rows
from Sales

Code with Error (in teory is the same, first I try to convert to str a set
and after reconvert the str to a set):

select
{ [Measures].[Unit Sales] } on columns,
strtoset(settostr({customers.[Name].members}))
on rows
from Sales
The error is something like :
"Unable to open cellset ... Token is not valid .... '[Customers]. .....
,^,^,,,,,,,,, }"

My question is if it is a bug or a limitation of the string size that the
function returns ?

Thanks for the help.

Alex


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.