Question

Sorting a list by missing attribute removes the list altogether

  • 7 September 2016
  • 6 replies
  • 1 view

Hello,

I have a workspace where polygons and points are combined using a NeighborFinder, creating a list of points close to my polygons. Depending on my inputs (various .csv files), these points have different existing attributes and many that are missing. My method for finding the highest value per polygon for all nearby points was to sort the resulting list of close candidates by descending value, and then use an AttributeCreator to extract the list{0}.attribute value to a proper attribute. I do this for about a dozen attributes, some of which are missing, depending on my input data.

My problem occurs when the ListSorter gets to one of these missing attributes. My expectation was that the list{0}.attribute would simply pass on a null or missing value, but what happens instead is that the list is removed entirely, or at least all list elements seem to be. Inspecting my polygons immediately after the ListSorter shows that none of my polygons have a list value anymore. Is this intended behavior, and if so, why?

Other attributes within the same list element still have values so removing the elements entirely because of a failed Sort seems rather rigorous.


6 replies

Userlevel 4
Badge +25

I've just tried it and can confirm that this is happening, list elements which lack the attribute that you're sorting on are removed.

A workaround would be to use an AttributeManager or AttributeCreator before building the list, set a conditional value on the attribute (copy value if it exists, fill with a default one otherwise)

Badge +16

Another option is the use the NullAttributeMapper to set a default value.

I've just tried it and can confirm that this is happening, list elements which lack the attribute that you're sorting on are removed.

A workaround would be to use an AttributeManager or AttributeCreator before building the list, set a conditional value on the attribute (copy value if it exists, fill with a default one otherwise)

Yes, this is what I ended up doing, thanks. Works fine but I was surprised that is was necessary.

 

 

Userlevel 4
Badge +25
Sadly it seems to be a known issue not yet fixed. The reference number is PR#44584. I've added a link to this thread so we are informed when it is fixed. Apologies for the problems it is causing.

 

Userlevel 3
Badge +13

We're just going to fix this for FME 2017. Sorry about this one! (And thanks for giving me an excuse to do some old fashioned transformer programming after a hard day of intense meetings).

Userlevel 4
Badge +25

We're just going to fix this for FME 2017. Sorry about this one! (And thanks for giving me an excuse to do some old fashioned transformer programming after a hard day of intense meetings).

Fixed in 2017 - in build 17157 or later.

 

 

Reply