Planning Analytics

 View Only
  • 1.  How to get property of a property with restapi?

    Posted Mon February 10, 2020 07:09 PM
    ​Hi,
    I am hoping to GET all the elements (return code and description which is an attribute) within a subset and the first parent with restapi.

    The highlighted syntax is not right, can anyone please show me the correct way to construct the URL?

    Dimensions('xx')/Hierarchies('xx')/Subsets('xx')/Elements?$select=Name,Level,Attributes($select=codeanddesc)&$expand=Parents($top=1)
    url

    Thanks
    Gaby

    ------------------------------
    Gaby Yuan
    ------------------------------

    #PlanningAnalyticswithWatson


  • 2.  RE: How to get property of a property with restapi?
    Best Answer

    Posted Tue February 11, 2020 06:51 AM
    Hi Gaby,

    Assuming you know you have an element attribute named currency you can do something like this:

    https://pa.localdomain.com:12354/api/v1/Dimensions('plan_business_unit')/Hierarchies('plan_business_unit')/Subsets('All Business Units')/Elements?$select=Name,Level,Attributes/Currency&$expand=Parents($top=1)

    Let me know if this helps.

    ------------------------------
    Stuart King
    IBM Planning Analytics Offering Manager
    ------------------------------



  • 3.  RE: How to get property of a property with restapi?

    Posted Wed February 12, 2020 08:02 AM
    Thank you Stuart for your prompt response.​

    ------------------------------
    Gaby Yuan
    ------------------------------



  • 4.  RE: How to get property of a property with restapi?

    Posted Tue February 11, 2020 11:05 AM
    Hi Gaby,

    First, the syntax you are using, parens immediately following a property name representing a singleton is nowhere allowed in the OData specification, which is hopefully kind of what the error you got implied.

    Secondly, Attributes is a (see the metadata for the service) ComplexType. which indeed, like the sample Stuart showed you, requires you to use path syntax to select properties of such type. On top of that Attributes is an open type (read: can have properties not explicitly defined in the metadata), properties which in this case represent the attributes associated to such element (or any other type that supports attributes in TM1 for that matter). These properties are never auto-expanded in the response and therefore have to be explicitly 'selected' using the forementioned path syntax. If however, a requested property doesn't exist it will simply be ignored in the normal OData JSON response, and represented by a null value if you happened to be using our experimental Compact JSON format.

    ------------------------------
    Hubert Heijkers
    ------------------------------



  • 5.  RE: How to get property of a property with restapi?

    Posted Wed February 12, 2020 08:03 AM
    ​Thank you Hubert for the detailed explanation, much appreciated!

    ------------------------------
    Gaby Yuan
    ------------------------------