cubewise-code / tm1py

TM1py is a Python package that wraps the TM1 REST API in a simple to use library.
http://tm1py.readthedocs.io/en/latest/
MIT License
189 stars 109 forks source link

Missing function to get hierarchy by name with Dimension object #86

Closed pbuncik closed 5 years ago

pbuncik commented 5 years ago

I think it would be nice to have a method of Dimension object to return hierarchy by name. Currently there is only a service's method to do it.

MariusWirtz commented 5 years ago

@pbuncik PR #88 introduces __getitem__ and __contains__ methods on the Dimension class. you can access a hierarchy on a dimension now like this:

        dimension = self.tm1.dimensions.get(dimension_name="Dimension")
        hierarchy = dimension["Hierarchy3"]

or

        dimension = self.tm1.dimensions.get(dimension_name="Dimension")
        hierarchy = dimension["Leaves"]

Does that work for you?

pbuncik commented 5 years ago

This is a good solution, thank you. BR Petr

From: Marius Wirtz notifications@github.com Sent: Monday, 28 January 2019 23:51 To: cubewise-code/tm1py tm1py@noreply.github.com Cc: Petr Buncik pbuncik@cubewise.com; Mention mention@noreply.github.com Subject: Re: [cubewise-code/tm1py] Missing function to get hierarchy by name with Dimension object (#86)

@pbuncikhttps://github.com/pbuncik PR #88https://github.com/cubewise-code/tm1py/pull/88 introduces getitem and contains methods on the Dimension class. you can access a hierarchy on a dimension now like this:

    dimension = self.tm1.dimensions.get(dimension_name="Dimension")

    hierarchy = dimension["Hierarchy3"]

or

    dimension = self.tm1.dimensions.get(dimension_name="Dimension")

    hierarchy = dimension["Leaves"]

Does that work for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/cubewise-code/tm1py/issues/86#issuecomment-458334300, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApuGmPToBcogPp1Z9ZlDNFdbXm-LnR0Lks5vH37TgaJpZM4aQS0W.