Skip to main content
Solved

Making all non-numeric values null


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.

View original
Did this help you find an answer to your question?

3 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • 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
Influencer
  • 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
Influencer
  • May 17, 2018
takashi wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings