Change weight in TI

Post Reply
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Change weight in TI

Post by macsir »

Hi, anyone knows how to change weight in TI for existing elements?
I tried to use DIMENSIONELEMENTCOMPONENTADDDIRECT/DIMENSIONELEMENTCOMPONENTADD functions. They don't work.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Change weight in TI

Post by Alan Kirk »

macsir wrote:Hi, anyone knows how to change weight in TI for existing elements?
I tried to use DIMENSIONELEMENTCOMPONENTADDDIRECT/DIMENSIONELEMENTCOMPONENTADD functions. They don't work.
That doesn't surprise me; I don't think that any of the "add" functions do anything if the element already exists in the dimension or consolidation, as the case may be.

I haven't tested it but I think the way you'd need to do that is with DimensionElementComponentDelete to get rid of the existing child then DimensionElementComponentAdd to add it back with the new weighting, all in either Prolog or Metadata, obviously.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Change weight in TI

Post by macsir »

Alan Kirk wrote:
macsir wrote:Hi, anyone knows how to change weight in TI for existing elements?
I tried to use DIMENSIONELEMENTCOMPONENTADDDIRECT/DIMENSIONELEMENTCOMPONENTADD functions. They don't work.
That doesn't surprise me; I don't think that any of the "add" functions do anything if the element already exists in the dimension or consolidation, as the case may be.

I haven't tested it but I think the way you'd need to do that is with DimensionElementComponentDelete to get rid of the existing child then DimensionElementComponentAdd to add it back with the new weighting, all in either Prolog or Metadata, obviously.
Thanks, Alan. That works but since I have dimension sheet attach to it, it won't get refreshed if I updated it in TI. Any idea to sync them?
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Change weight in TI

Post by Alan Kirk »

macsir wrote:
Alan Kirk wrote:
macsir wrote:Hi, anyone knows how to change weight in TI for existing elements?
I tried to use DIMENSIONELEMENTCOMPONENTADDDIRECT/DIMENSIONELEMENTCOMPONENTADD functions. They don't work.
That doesn't surprise me; I don't think that any of the "add" functions do anything if the element already exists in the dimension or consolidation, as the case may be.

I haven't tested it but I think the way you'd need to do that is with DimensionElementComponentDelete to get rid of the existing child then DimensionElementComponentAdd to add it back with the new weighting, all in either Prolog or Metadata, obviously.
Thanks, Alan. That works but since I have dimension sheet attach to it, it won't get refreshed if I updated it in TI. Any idea to sync them?
Ah. You didn't mention that you had an .xdi. That changes things radically.

Nobody should ever modify a dimension which is .xdi-based using a non-xdi method. Dimension Editor and TI can be mixed, but .xdi should never be used with any other method. (Admittedly Dim Editor will rebuild an .xdi for you (if you have all of your settings correct) but you lose many of the advantages of .xdis that way.)

The good news is that if you're using an .xdi changing the weighting is a doddle; you just put the new weighting in column C and recompile the dimension.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Change weight in TI

Post by macsir »

ta. Alan.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
User avatar
gtonkin
MVP
Posts: 1198
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Change weight in TI

Post by gtonkin »

macsir wrote:I tried to use DIMENSIONELEMENTCOMPONENTADDDIRECT/DIMENSIONELEMENTCOMPONENTADD functions. They don't work.
Depending on how you are applying the "direct" commands, you may need to use a

Code: Select all

DimensionUpdateDirect(DimName);
to finalise.
User avatar
macsir
MVP
Posts: 782
Joined: Wed May 30, 2012 6:50 am
OLAP Product: TM1
Version: PAL 2.0.9
Excel Version: Office 365
Contact:

Re: Change weight in TI

Post by macsir »

gtonkin wrote: Depending on how you are applying the "direct" commands, you may need to use a

Code: Select all

DimensionUpdateDirect(DimName);
to finalise.
Hi, gtonkin
Thanks for the advice, I checked this function as well. It doesn't work. But the function name sounds like it should do the trick. :lol: It is more like garbage collection in Java to clean up the footprint in Ram from other direct functions if I am not wrong.
In TM1,the answer is always yes though sometimes with a but....
http://tm1sir.blogspot.com.au/
Gabor
MVP
Posts: 170
Joined: Fri Dec 10, 2010 4:07 pm
OLAP Product: TM1
Version: [2.x ...] 11.x / PAL 2.0.9
Excel Version: Excel 2013-2016
Location: Germany

Re: Change weight in TI

Post by Gabor »

You could simply update col C in .xdi, but if you really need to have your change done using TI, then you can go ahead with Alan's approach and finally recreate the .xdi from .dim again.
After the TI has made all changes, just use the Dim editor in Perspectives and add a dummy element like 123 to "yourdim", while you have your local server option in Perspectives pointed to the folder, where a file "yourdim.xdi" resides. This can be the old yourdim.xdi or any file renamed (e.g. blank file created by Notepad) for initial .xdi creation for example.
Post Reply