-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Describe the bug
Given the example from clearing-cube-data-with-tm1py is quite convenient to use the function cells.clear() but if there is the need to clear some data from a special hierarchy the function won't work and successfully clears nothing.
To Reproduce
Lets say we have a cube Sales with 4 dimensions: product, year, month, age, category and the dimension category has more than one hierarchy and we want to clear the data from the some_category hiearchy.
from TM1py import TM1Service
with TM1Service(address="localhost", port=12354, user="admin", password="apple", ssl=True) as tm1:
tm1.cells.clear(
cube="Sales",
product="[Product].[10]",
year="[Year].[2023]",
month="[Month].[11]")
It generates this MDX:
SELECT
NON EMPTY
{[product].[10]}
* {[Year].[2023]}
* {[Month].[11]}
* {TM1FILTERBYLEVEL({TM1SUBSETALL([age].[age])},0)}
* {TM1FILTERBYLEVEL({TM1SUBSETALL([category].[category])},0)}
DIMENSION PROPERTIES MEMBER_NAME ON 0
FROM [Sales]
There is no way to manipulate
Expected behavior
I think, the function can be extended with a mapping parameter like: mapping = {"category":"some_category"} if the hierarchy name differs from the dimension name. In this case we can still use the generic function cells.clear() instead of cells.clear_with_mdx() and we get:
SELECT
NON EMPTY
{[product].[10]}
* {[Year].[2023]}
* {[Month].[11]}
* {TM1FILTERBYLEVEL({TM1SUBSETALL([age].[age])},0)}
* {TM1FILTERBYLEVEL({TM1SUBSETALL([category].[some_category])},0)}
DIMENSION PROPERTIES MEMBER_NAME ON 0
FROM [Sales]
Version
TM1py: 1.11.3
TM1 Server Version: 11.8