Planning Analytics

Planning Analytics

Get AI-infused integrated business planning

 View Only
  • 1.  REST API Dimension Element Ordering

    Posted Thu April 04, 2024 10:21 AM

    Hi all,

    is there a function or action to mimic the "Dimension Element Ordering" ->Automatic Sort By "Hierarchy" in architect via REST API call?

    I was looking though the metadata.xml but couldn't find an action.

    Best regards,

    Thilo



    ------------------------------
    Thilo Thurner
    ------------------------------


  • 2.  RE: REST API Dimension Element Ordering

    Posted Fri April 05, 2024 03:13 AM

    I'm not sure if there is a REST API function for this. What you could do through REST API is to run an unbound TI process where you use the DimensionSortOrder function or you could directly write the applicable values to the }DimensionProperties cube.

    Kind regards,

    Luc



    ------------------------------
    Luc Cusiel
    ------------------------------



  • 3.  RE: REST API Dimension Element Ordering

    Posted Fri April 05, 2024 09:59 AM

    Hi Luc,

    I ended up with the workaround to write the value directly into the }DimensionProperties cube with /tm1.Update action.

    Thank you for that hint!

    Best regards,

    Thilo



    ------------------------------
    Thilo Thurner
    ------------------------------



  • 4.  RE: REST API Dimension Element Ordering

    Posted Fri April 05, 2024 10:37 AM

    I love it when PA mixes up 'elements' and 'hierarchies' so technically this is a misnomer to begin with (elements live in a graph whereas members live in hierarchies) but because you only start noticing the difference if yo have multi-parent elements people like to mix things up ;-).

    That said, kind of expecting you'd actually want all the members anyway if you are looking at a hierarchy, you could simply pull the Members instead of the Elements and, if you needed an Element specific property, expand the Element navigation property of the Member to get to it.  I.o.w.

    `GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Members`

    gives you all Members in hierarchy order.

    But effectively you can grab any collection of Members as long as you express it as an MDX set expression, using the ExecuteMDXSetExpression. Simply pass the MDX expression for the set, in your Hierarchy ordered example simply `Hierarchize( [<<Dimension>>].[<<Hierarchy>>].MEMBERS )` (albeit in this particular case where using Members function the order is, like the set above, Hierarchized by default), and then pull the individual Members from the response.

    And if you happened to have multi-parent element and you really only want the first member representing such element (and have all other representation of the same element, as a component under the other parents, omitted) then you could use `Hierarchize( TM1SubsetAll([<<Dimension>>]))` as the MDX expression for the set.

    Another way, if you are happy to deal with some nested [JSON] response from the REST API, you could simply grab the Elements of a Hierarchy, filter them to only the 'root' elements (read: elements with no parents) and then expand the components as in:

    `GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Elements?$filter=Parents/$count eq 0&$expand=Components`

    this would only give you one level but you can nest this as many levels as you like as in, let's say two extra levels:

    `GET ~/Dimensions('plan_time')/Hierarchies('plan_time')/Elements?$filter=Parents/$count%20eq%200&$expand=Components($expand=Components($expand=Components))`

    Hope this helps,



    ------------------------------
    Hubert Heijkers
    STSM, Program Director TM1 Functional Database Technology and OData Evangelist
    ------------------------------



  • 5.  RE: REST API Dimension Element Ordering

    Posted Mon April 08, 2024 06:46 AM

    Thanks for the additional information Hubert!
    And yes, the "sort by Hierarchy" can be a little bit confusing regarding the nomenclature.
    For my initial target I just wanted to mimic the sort by hierarchy if someone opens the dimension to see the elements more "organized".

    But I really like your last tip, that could help for another requirement later on.

    BR



    ------------------------------
    Thilo Thurner
    ------------------------------