Forum Discussion

Breton's avatar
Breton
Ideator III
4 years ago

how getProperty from diffrents level of AML reponse

After applying an AML query, I have a response (structure with root and relation)

How can I get properties from each level of the response?
for example, I would like to get ID at different levels of the responses (Root and relationShip)

For first level..easy...with Item.getID();
But how to getProperty for relationShip (
r02xx_i0203GPHead) linked ?

Index = 1
type="i0213_AfterSales" id="4EBE1FC05B62427582A9FBB1BED9BF36
type="r02xx_i0203GPHead" id="2B3F208CCD88407A97AA14BD3A1E29B9

Index = 2
type="i0213_AfterSales"  id="DC2DCC728E534797BCF98CB00950F717
type="r02xx_i0203GPHead" id="1C88AEAFDDF641DC87ABB48777B3964B
Index = ...
 



[View:/cfs-file/__key/communityserver-discussions-components-files/3/rep2.xml:320:240]

2 Replies

  • HI Brenton,

    I really wished Aras would have the possibility to pass a level index with these kind of queries. See my question here... :-D :

    https://community.aras.com/f/development/37188/how-to-get-level-depth-of-items-returned-from-an-getitemrepeatconfig-aml-query

    Do you know how much levels you have (fixed number of levels)? Then you could use an xpath selector. I don´t have proper sample at hand right now, but try something like this:

    var level2items = item.getItemsByXPath("Relationships/Item[@type='Part BOM']/related_id/Item[@type='Part']");
    var level3items = item.getItemsByXPath("Relationships/Item[@type='Part BOM']/related_id/Item[@type='Part']/Relationships/....;

    Search for better samples regarding xpath. Not sure if the above one works.

    If you just need all items are related at all, something simpler would work:

    var allItems= item.getItemsByXPath("//Item[@type='Part']");

    • Breton's avatar
      Breton
      Ideator III

      ok, thanks
      I will test.
      Thanks a lot

      FB