I have used a Aggregate tool over a table of attributes of a shapefile and then made a Join of this Aggregated layer to the original layer based on the Group_By attribute. This was performed to check if the result is what was expected. However, a strange behavior of come out with the Select By Expression tool, selecting those records that look apparently as selected improperly. What could case this behavior of the Select By Expression tool?

Aggregete was done with the following settings: enter image description here

After that the Join was performed, as mentioned above. One of the attributes stored values in float (10, 2) format (Catch_m2). This was also aggregated as float (10,2). enter image description here

The streange result was received when I entered this query: enter image description here

And the result: enter image description here

As could be seen only 10 recordes were selected, while it is apparent that 20 of them meet the criteria.

What is more, when I modified the query to the following: enter image description here and over 22000 records were selected, majority of which visually should have not meet the criterion. Supprisingly, some did not get selected properly. enter image description here

I would be very grateful for a solution. Was this an Aggregate function not doing its job properly? Or that it is stored in as temporary layer matters? Finally, this is an important issue, because it undermines the reliability of the Selection By Expression tool!

Best regards, Kamila

A follow up:

After comment of Nick I have made a join with a permanent attribute table of a shapefile (rzekio_AGREGACJA_poIDHYD10.shp). The previous one was a temporary layer.

The results are as follows: enter image description here And I made another query obtaing correct results. enter image description here

This case makes me to conclude that it is not safe to compare temporary layers, as they may store values in different field formats than e.g. shapefiles. And it is always best to check the format of fields before making comparisons.

  • 1
    I don't have an answer, but a couple observations: In the second screenshot, note the value of the "Nazwa typu" column. For the first field the value is "Real", for the "Zegregowane..." field the value is "double". Also, in the final screenshot, we shouldn't expect to see any of those records selected based on your query. But all of those that were incorrectly selected have exactly 10 digits (the full length of the field), whereas all those with <10 digits are correctly left unselected. This post may also help.
    – Nick
    Mar 1 at 17:14
  • Thank you for this tip! Indeed, the problem occurred for the records mentioned by you. In the follow up I add a comment on how I overcome the problem.
    – Kamila
    Mar 4 at 9:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.