Calling DBRW function without mentioning instance name in the first argument

Post Reply
hemheman
Posts: 5
Joined: Sun Dec 17, 2017 10:10 am
OLAP Product: TM1
Version: 10.2.1
Excel Version: 1711

Calling DBRW function without mentioning instance name in the first argument

Post by hemheman » Fri Jul 20, 2018 12:10 pm

Hello Everybody,

I am trying to call DBRW function in excel. I know it is simple to call.
But my question here his can we call DBRW function from excel without mentioning instance name in the first argument (cube argument) in the function.
I want to return instance name from the cube (where the instance value stored). To achieve that I have to use DBRW function. But I want use DBRW in a different way.
Let us understand above scenario with an example:
Say my instance name is 'MyInsta'.
'MyInsta' value stored in a cube named 'MyCube'.
I want to return 'MyInsta' value from cube 'MyCube' using DBRW (or any other alternative if we have any).
The standard notation is DBRW("MyInsta:MyCube", dimelem1, dimelem2, dimelem3,..., dimelemn)
But I cannot use above notatino as I want to return 'MyInsta' value from 'MyInsta' itself rather than hardcoding in the DBRW function/or store any where in the excel and call that from excel cell.

Let me know if any one have any insights on the above case.

Thanks,
Hemanth

User avatar
tomok
MVP
Posts: 2464
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Calling DBRW function without mentioning instance name in the first argument

Post by tomok » Fri Jul 20, 2018 12:17 pm

hemheman wrote:
Fri Jul 20, 2018 12:10 pm
But my question here his can we call DBRW function from excel without mentioning instance name in the first argument (cube argument) in the function.
Simple answer, no.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/

Wim Gielis
MVP
Posts: 1748
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1
Version: PAL 2.0
Excel Version: 2016
Location: Brussels, Belgium
Contact:

Re: Calling DBRW function without mentioning instance name in the first argument

Post by Wim Gielis » Fri Jul 20, 2018 12:43 pm

Next to being impossible technically, I’m struggling to find a real life use case for this situation. So you want to retrieve a value from a cube, but you don’t know which TM1 instance the cube is in. I can understand that. But then the choice for which instance it is, is set in a cube. I get that too. But I don’t get that that cube holding the information is part of the instance that you’re looking for. You can’t know the instance where the cube is, that holds the instance information for the first cube ? Maybe a drop down menu of instance names (and the user being logged on to the needed instances) ?
Best regards,

Wim Gielis

Excel Most Valuable Professional, 2011-2014
http://www.wimgielis.com ==> 105 TM1 articles and a lot of custom code
Newest blog article: Looping over input files

User avatar
Elessar
Posts: 136
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010
Location: Russia

Re: Calling DBRW function without mentioning instance name in the first argument

Post by Elessar » Fri Jul 20, 2018 2:10 pm

Hi,

If you are on PAL 2, you can use "TM1PRIMARYDBNAME()" worksheet function to get the instance name:
https://www.ibm.com/support/knowledgece ... ction.html

If this is for migrating purpose, another method is discussed here: http://www.tm1forum.com/viewtopic.php?p=22913
Sorry for my English ;)

User avatar
Steve Rowe
Site Admin
Posts: 1783
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: 10.2.2., PAW
Excel Version: Nearly all of them

Re: Calling DBRW function without mentioning instance name in the first argument

Post by Steve Rowe » Fri Jul 20, 2018 3:22 pm

A use case for this is also to allow migration of application workbooks from Dev to live. You can use the TM1User function to determine which instance from a known list of instances you are connected to.
A1= TM1User("Dev")
A2= TM1User("UAT")
A3= TM1User("Prod")

B1=A1
B2=If(A2="",B1,A2)
B3=If(A3="",B2,A3)

This formula should result in B3 containing the instance name you are connected treating A3, A2 then A1 in order of priority.

Edit : Woops duplicate of cross linked post above...

hemheman
Posts: 5
Joined: Sun Dec 17, 2017 10:10 am
OLAP Product: TM1
Version: 10.2.1
Excel Version: 1711

Re: Calling DBRW function without mentioning instance name in the first argument

Post by hemheman » Tue Jul 24, 2018 10:21 am

Elessar wrote:
Fri Jul 20, 2018 2:10 pm
Hi,

If you are on PAL 2, you can use "TM1PRIMARYDBNAME()" worksheet function to get the instance name:
https://www.ibm.com/support/knowledgece ... ction.html

If this is for migrating purpose, another method is discussed here: http://www.tm1forum.com/viewtopic.php?p=22913
Thanks a lot Elessar, I am able achieve my requirement with TM1PRIMARYDBNAME(). Thanks a ton :D

hemheman
Posts: 5
Joined: Sun Dec 17, 2017 10:10 am
OLAP Product: TM1
Version: 10.2.1
Excel Version: 1711

Re: Calling DBRW function without mentioning instance name in the first argument

Post by hemheman » Tue Jul 24, 2018 10:22 am

Thanks all for your valuable response!

Now I am able to achieve my requirement with TM1PRIMARYDBNAME() function.

Post Reply