Skip to main content

Hello all,

I have 1721 point features, which I am combining into a single line using LineBuilder.

Each node has a datetime stamp, and I want to populate the line with the attributes "start_date" and "end_date" drawn from the "date" attribute of the first and last point feature.

In the LineBuilder I have ticked the parameter Generate List, so I have a list with 1721 elements.

I can use the Attribute manager to create a new attribute "start_date" with a value of;

@Value(points{0}.date)

However, I fail to do the equivalent for the last element in the list.

@Value(points{-1}.date) is not accepted by the Text editor or the List Element Selection: points{}.date

I thought I might solve it by using ListElementCounter, which does create a new attribute with a value of 1721, but again the List Element Selection: does not accept an attribute value as an input.

 

Maybe have a look at this post https://knowledge.safe.com/questions/68957/get-the-last-index-of-an-array.html


Thanks @deanhowell2009, I checked out that post, and chose the ListIndexer, which does allow a value of -1 for the list index.

Note: my list is points{} with a single attribute "date" and 1721 elements.

List Attribute: points{}

List Index to Copy: -1

Copied Attribute Prefix: end_

The end result was a new attribute of "end_date" populated with the value from the last element in the list. This is exactly the result I am looking for :-)

I also did a second ListIndexer to grab the start_date


Reply