Deleting elements from dimension

Post Reply
lax9
Posts: 12
Joined: Thu Apr 12, 2018 9:51 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2016

Deleting elements from dimension

Post by lax9 »

Hi All,

Can we delete some elements from a dimension using TI? or any other way?

Below is my scenerio:
We have some test invoices in the dimension which needs clean up. They want to delete invoices based on the time period(example: delete all invoices before this date??)

Can we delete these test invoices from the dimension depending on the time period??

Please share your suggestions. Thank you!
bgregs
Posts: 77
Joined: Wed Sep 12, 2018 11:19 am
OLAP Product: TM1 / Planning Analytics
Version: 2.0
Excel Version: 2016

Re: Deleting elements from dimension

Post by bgregs »

Absolutely! In the Metadata tab use DimensionElementDelete to remove the element (obviously after you put your own condition on which to remove the element into the code).

However, I don't usually like to remove history from the system unless it is truly a test case. If you have a "current invoice" node or something similar, just use DimensionElementComponentDelete to remove it from that node and then DimensionElementComponentAdd to a "historic" node or something similar.
lax9
Posts: 12
Joined: Thu Apr 12, 2018 9:51 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2016

Re: Deleting elements from dimension

Post by lax9 »

Can you get me a sample code?
bgregs
Posts: 77
Joined: Wed Sep 12, 2018 11:19 am
OLAP Product: TM1 / Planning Analytics
Version: 2.0
Excel Version: 2016

Re: Deleting elements from dimension

Post by bgregs »

I'd be happy to help look at your current code that you may be having issues with, but I will not write your TI for you. ;)
lax9
Posts: 12
Joined: Thu Apr 12, 2018 9:51 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2016

Re: Deleting elements from dimension

Post by lax9 »

I don't have one. That's the reason looking for sample code.
Wim Gielis
MVP
Posts: 3113
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: Deleting elements from dimension

Post by Wim Gielis »

That function is pretty simple, you can look at the documentation since you have been given the function name:

https://www.ibm.com/support/knowledgece ... elete.html

You supply a dimension name and an element name and you write the code in the Metadata tab.
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
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: Deleting elements from dimension

Post by tomok »

Obviously, the DimensionElementDelete function is quite simple. What is not so simple, and what I think the OP is after, is how to filter to just the elements that match the criteria he specified, namely those invoices create/posted/??? after a specific date. The first requirement is going to be some sort of attribute on the Invoice dimension that tells you when it was posted. If you don't have that then forget it. Ain't gonna happen. If you do then the trick is to write an MDX query that will filter based on that date. Use that to create a subset on the Invoice dimension and use that as a data source. Then put the DimensionElementDelete function in the Metadata tab. Sorry, I don't have any sample code. I suggest trying to write it and come back for specific assistance.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Wim Gielis
MVP
Posts: 3113
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: Deleting elements from dimension

Post by Wim Gielis »

Indeed Tom, but in my opinion you have to build up this code step by step. If writing the code to delete an element does not work, then it will definitely not work based on attributes and comparisons and MDX’s. Also I first wanted to see an effort from the OP, like bgregs too I think.
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
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: Deleting elements from dimension

Post by BariAbdul »

"You Never Fail Until You Stop Trying......"
Post Reply