How can we use AttributeCreator which receives an array of data to only pull the last index of that array?
If you are talking about lists in FME: The ListElementCounter will count the number of elements in a specified list. The highest index is the result of the ListElementCounter -1 (lists start at 0).
If it's an attribute list, you can use the following functions in an AttributeCreator.
To get the last index of _list{}:
@Evaluate(@NumElements(_list{})-1)
To get the last value of _list{}:
@Value(_list{@Evaluate(@NumElements(_list{})-1)})
Here's an example of what the array looks like:
capture.png
200 results contain 213 attributes of this array. I would like to get the last index of each of those arrays/nested arrays. For example, if d:ArrayOfanyType{1}.anyType{11} is the last array for d:ArrayOfanyType{1}, I want to get its value.
I hope this is clear, let me know if you need more clarification.
If it's an attribute list, you can use the following functions in an AttributeCreator.
To get the last index of _list{}:
@Evaluate(@NumElements(_list{})-1)
To get the last value of _list{}:
@Value(_list{@Evaluate(@NumElements(_list{})-1)})
Posted an idea to allow use of negative numbers to get list elements from the end of list e.g. _list{-3}:
https://knowledge.safe.com/idea/72944/use-negative-numbers-to-get-list-element-from-end.html
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.