Page 1 of 1

MDX USERNAME, differences in CAM and Mode 1?

Posted: Mon Oct 26, 2020 4:49 pm
by Steve Rowe
Hi,
I've been banging my head against this one for a while now.

In my mode 1 dev environment I have the following MDX statement.

Code: Select all

 {StrToMember("[WARF ID].[Total " + [Front End Selection].([}Clients].["+USERNAME+"] ,[Selector].[WARF ID]) +"]").Children}
This behaves exactly as expected, returning the children of the element selected in my front end cube.

In the UAT environment which is set up under Mode 5 CAM the same MDX generates the error, STRTOMEMBER: Error in value expression: "" (There is a valid item selected in the front end cube)

If I substitute the value in the cube into the MDX just to check the general form of the MDX, then the MDX behaves as expected.

Code: Select all

 {StrToMember("[WARF ID].[Total LB000001L]").Children}
I'm assuming that there is a problem with the initial expression because the form of the CAM user name CAMID("Domain:blah") with the extra double quotes is causing an issue with the parsing of the username.

The odd thing is that this works correctly in the mode 5 environment.

Code: Select all

{StrToMember("[}Clients].["+USERNAME+"]") }
I've tried to substitute the above expression for the user name into my longer piece of MDX in place of the username reference in a few different ways to no effect.

Any ideas what's going on here?

It feels like a defect given that the simpler expression compiles but the more complex one does not.
Cheers,

Re: MDX USERNAME, differences in CAM and Mode 1?

Posted: Mon Oct 26, 2020 5:45 pm
by Adam
Hi Steve,

Instead of your ("first form"):

Code: Select all

 {StrToMember("[WARF ID].[Total " + [Front End Selection].([}Clients].["+USERNAME+"] ,[Selector].[WARF ID]) +"]").Children}
Does this work? ("second form"):

Code: Select all

 {StrToMember("[WARF ID].[Total " + [Front End Selection].(StrToMember( "[}Clients].[" + USERNAME + "]" ) ,[Selector].[WARF ID]) +"]").Children}
In the first form, I can recreate the same error as you in our Mode 5 setup but it works as expected in the second form.

Re: MDX USERNAME, differences in CAM and Mode 1?

Posted: Mon Oct 26, 2020 6:19 pm
by Steve Rowe
Thanks alot Adam, Really appreciate it.

Working now, I'd swear blind that I'd tried that but probably not got exactly the right combination of brackets and quotes and pluses and brackets.

Really odd that the original form works in mode 1 but not in 5.

Cheers,

Re: MDX USERNAME, differences in CAM and Mode 1?

Posted: Tue Oct 27, 2020 12:07 pm
by tomok
Steve Rowe wrote: Mon Oct 26, 2020 6:19 pm Thanks alot Adam, Really appreciate it.

Working now, I'd swear blind that I'd tried that but probably not got exactly the right combination of brackets and quotes and pluses and brackets.

Really odd that the original form works in mode 1 but not in 5.

Cheers,
I think it's because a user ID in CAM looks like this:

Code: Select all

CAMID("ActiveDirectyID")
while one in Mode 1 probably looks like this:

Code: Select all

UserID
Since the CAM ID is encapsulated inside apostrophes it is going to need different code to make your MDX work versus when it is Mode 1.

Re: MDX USERNAME, differences in CAM and Mode 1?

Posted: Tue Oct 27, 2020 12:59 pm
by Steve Rowe
Hi Tom,

I think the CAMID having the double quotes is the trigger for the problem but I've still not reached an understanding of why

Code: Select all

{StrToMember("[}Clients].["+USERNAME+"]") }
Is fine in both modes but

Code: Select all

 {StrToMember("[WARF ID].[Total " + [Front End Selection].([}Clients].["+USERNAME+"] ,[Selector].[WARF ID]) +"]").Children}
Only works mode 1.
My suspicion is that the statement shouldn't work in mode 1 either. The quote positioning seems off. Not really had time to really look hard as I am deep in the project right now.

Cheers,