# How do I select the last array of an undefined long object?

**URL:** <https://discourse.nodered.org/t/how-do-i-select-the-last-array-of-an-undefined-long-object/8397>\
**Category:** General\
**Created:** [26 February 2019 09:46 UTC](https://discourse.nodered.org/t/how-do-i-select-the-last-array-of-an-undefined-long-object/8397 "2019-02-26T09:46:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YT2310](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yt2310/32/35255_2.png) [@YT2310](https://discourse.nodered.org/u/YT2310)\
**Post date:** [26 February 2019 09:46 UTC](https://discourse.nodered.org/t/how-do-i-select-the-last-array-of-an-undefined-long-object/8397/1 "2019-02-26T09:46:05Z")

</div>

Hello there,

Can the last array of an undefined object be selected? It's undefined because I'm converting the object from an XML string that receives new data from time to time.  
this would mean that the 50 has to change at every new stamp.  
Since I do not always get the same amount of new data in the xml file, I can not solve this problem with the semantics I know.  
`payload.data.counterinfo[50].$.value;`

Thank you for your suggestions!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 February 2019 09:49 UTC](https://discourse.nodered.org/t/how-do-i-select-the-last-array-of-an-undefined-long-object/8397/2 "2019-02-26T09:49:45Z")

</div>

well... as `payload.data.counterinfo` is an array - it will have a length... so `payload.data.counterinfo.length` will be the total length - the last element will be that minus 1 (as the array starts at 0).
