Skip to main content
Solved

Not all values used in minimum-calculation

  • April 12, 2018
  • 5 replies
  • 59 views

I have a shapefile with multiple float-fields. I want to calculate the minimum value of these fields. For some of the features the calculation is correct, but for some features the values are not used.

I use the AttributeCreator with the Arithmetic Editor: 

@min(@Value(BOVENGRENS),@Value(ONDERGRENS),@Value(WINTERPEIL),@Value(VAST_PEIL))

This gives the following result in the field Rekenpeil:

0684Q00000ArBmiQAF.jpg

Thank you for your replies!

Best answer by david_r

It's because of the NULL values, the value of min(n,NULL) = NULL, not n.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • April 12, 2018

It's because of the NULL values, the value of min(n,NULL) = NULL, not n.


  • Author
  • 2 replies
  • April 13, 2018

Then why is there a value in the first and fourth row? On those features there are also null values.


takashi
Celebrity
  • 7843 replies
  • April 13, 2018

Then why is there a value in the first and fourth row? On those features there are also null values.

Strange. The min function should return null always if one or more arguments were null. I was not able to reproduce the same situation as yours. Could you please share a minimal data and workspace which reproduce the situation?

 

 


david_r
Celebrity
  • 8394 replies
  • April 13, 2018

Then why is there a value in the first and fourth row? On those features there are also null values.

I agree with Takashi, that's indeed unexpected. I wasn't able to reproduce that either.

  • Author
  • 2 replies
  • April 16, 2018

I can't send the file, but thanks to your replies I have used a NullAttributeMapper to change the Null values to Empty, which has solved my problem. Thank you!