Page 1 of 1

Change weight in TI

Posted: Fri May 27, 2016 12:31 am
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.

Re: Change weight in TI

Posted: Fri May 27, 2016 1:00 am
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.

Re: Change weight in TI

Posted: Fri May 27, 2016 1:31 am
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?

Re: Change weight in TI

Posted: Fri May 27, 2016 2:21 am
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.

Re: Change weight in TI

Posted: Fri May 27, 2016 3:35 am
by macsir
ta. Alan.

Re: Change weight in TI

Posted: Fri May 27, 2016 6:33 am
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.

Re: Change weight in TI

Posted: Sun May 29, 2016 11:32 pm
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.

Re: Change weight in TI

Posted: Mon May 30, 2016 8:04 am
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.