Hi All,
I'm trying to validate dimension changes in a TM1 model. One step of the validation is to ensure that elements that may no longer be in some dimensions are not referenced in any rule (specifically Consolidated elements on hierarchies).
To do that I would need to scan the rule of a cube and search for specific strings that reference the elements to be deleted.
I checked in the current library but I don't see a function for it (I think). Technically this could be achieved by:
https://<tenant>.planning-analytics.ibmcloud.com/tm1/api/<instance>/api/v1/Cubes('name')?$select=Rules --> is that accurate?
Is there any way of getting this with TM1Py? I'm using v1.5.0
Thanks!
nico
Hi Nico,
rules is a property of a cube. You can access them like this:
from TM1py.Services import TM1Service
tm1 = TM1Service()
# Get all cube names
all_cubes = tm1.cubes.get_all_names()
# Loop through the cube names
for cube_name in all_cubes:
# Get the cube details
cube = tm1.cubes.get(cube_name)
# Access the rules property
cube_rule = cube.rules
print(cube_rule)
That's exactly what I needed!
Thanks a lot, Vinoth!
Most helpful comment
Hi Nico,
rulesis apropertyof a cube. You can access them like this: