Tm1py: Add ElementComponentAdd type of function

Created on 2 Dec 2020  路  4Comments  路  Source: cubewise-code/tm1py

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

  • TM1py 1.5.0
  • TM1 Server Version: 2.0.9.3

Additional context
N/A

question

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scrumthing picture scrumthing  路  4Comments

cubewise-gng picture cubewise-gng  路  5Comments

hermie64 picture hermie64  路  3Comments

VY109 picture VY109  路  4Comments

cubewise-gng picture cubewise-gng  路  3Comments