Calling DBRW function without mentioning instance name in the first argument

Post Reply
hemheman
Posts: 7
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 »

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
tomok
MVP
Posts: 2831
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 »

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: 3105
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

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

Post by Wim Gielis »

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

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
Elessar
Community Contributor
Posts: 331
Joined: Mon Nov 21, 2011 12:33 pm
OLAP Product: PA 2
Version: 2.0.9
Excel Version: 2016
Contact:

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

Post by Elessar »

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
Best regards, Alexander Dvoynev

TM1 and Data Science blog: 6th article - PAfE + VBA: Commit each cell without pressing “Commit” button.
User avatar
Steve Rowe
Site Admin
Posts: 2410
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

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

Post by Steve Rowe »

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...
Technical Director
www.infocat.co.uk
hemheman
Posts: 7
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 »

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: 7
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 »

Thanks all for your valuable response!

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