Skip to main content
Best Answer

Making all non-numeric values null

  • May 16, 2018
  • 3 replies
  • 151 views

I am taking data from a shapefile and mashing it with a CSV, and the attribute I am having issue with has null, numbers and non-numeric characters/alphabetic values (from the input).

The target field in my output is an integer type (uint). I would like to make Null all attributes of that field that are non-numeric (some are purely alphabetic; others have characters like in a date format).

I was hoping to use an AttributeManager that I was already utilizing to perform this operation, but I don't know how (or what other transformer would be best).

Best answer by erik_jan

I would use the AttributeValidator to check what records have a non integer value and then the AttributeSetter (will be the AttributeCreator) to set that value to Null.

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.

3 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • Best Answer
  • May 16, 2018

I would use the AttributeValidator to check what records have a non integer value and then the AttributeSetter (will be the AttributeCreator) to set that value to Null.


takashi
Celebrity
  • May 16, 2018

Yes, the AttributeValidator is a possible way. Alternetively, you can also use conditional value setting in the AttributeManager or the AttributeCreator. e.g.

If attr Type Is Integer Then <No Action> Else <null>

However, with those methods, I'm afraid that the workspace or parameters setting could become too cluttered if there were multiple target attributes. So I would use the NullAttributeMapper to make the workspace concise. [Updated]

0684Q00000ArJSuQAN.png



takashi
Celebrity
  • May 17, 2018

Yes, the AttributeValidator is a possible way. Alternetively, you can also use conditional value setting in the AttributeManager or the AttributeCreator. e.g.

If attr Type Is Integer Then <No Action> Else <null>

However, with those methods, I'm afraid that the workspace or parameters setting could become too cluttered if there were multiple target attributes. So I would use the NullAttributeMapper to make the workspace concise. [Updated]

0684Q00000ArJSuQAN.png


Sorry, the regular expression was wrong. I've corrected the screenshot above.