Page 1 of 1
Deleting elements from dimension
Posted: Wed Oct 03, 2018 2:14 pm
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!
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 2:42 pm
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.
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 3:19 pm
by lax9
Can you get me a sample code?
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 4:46 pm
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.

Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 6:08 pm
by lax9
I don't have one. That's the reason looking for sample code.
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 6:12 pm
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.
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 7:36 pm
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.
Re: Deleting elements from dimension
Posted: Wed Oct 03, 2018 7:50 pm
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.
Re: Deleting elements from dimension
Posted: Thu Oct 04, 2018 2:29 am
by BariAbdul