Describe what did you try to do with TM1py
I want to add elements to consolidation. In TM1 I would use DimensionElementComponentAdd and not having too much experience with tm1py that's what I was looking for.
It would be convenient to have a function that would combine
hierarchy.add_element and hierarchy.add_edge to get same result as mentioned TM1 function.
Describe what's not working the way you expect
N/A
Version
Additional context
N/A
You don't have to work line by line in python. You can combine those approaches into a single script. There are nice samples provided by Cubewise.
https://github.com/cubewise-code/tm1py-samples/blob/master/Metadata/dim_create.py
I kinda like the idea. Essentially you are saving one line of code and it's more intuitive for everyone coming from TI.
How do you imagine the signature of the function? Like this?
add_component(parent: str, element: str, weight: int)
If the parent doesn't exist or is of type str, I assume it should through an error?
@MariusWirtz
That's exactly what I had in mind, also regarding error.
@scrumthing
Thank you. I'm glad you appreciate the samples!