Skip to main content

Something simple but can’t get it to work. I have a Field1 with two records. One record contains numbers as 205202021356 and the other record does not contain numbers as DAKLL. I have an attributeManager where I want to assign a value for the records that do not contain numbers and keep the value the same for the records that are numeric. 

In the AttribteManager transformer, this is what I have under the AttributeValue field

 

2 possible values:

So if Field1 is not numeric, I want to assign NA

If it is numeric (contains numbers) then leave it with its original value

Sample below are the records. I want to assign NA to record 2 and keep record 1 as is.

Field1

205202021356

DAKLL

 

When I run the workbench, it keeps assigning NA to both records, rather than to one record. 

Thank you.

How did you get that Test Condition in there? The only way I am able to do that in the AttributeManager, is by typing in the word ‘Numeric’. But that won’t test if the attribute’s contents are numeric, it will test is the contents of the attribute are not equal to the string ‘Numeric’. Since both 205202021356 and DAKLL are not equal to Numeric, it will assign NA to the attribute.

Personally  would use the AttributeValidator for an issue like this. In there you can easily select validation on the Type being Numeric, so when it is it passes validation, if it isn’t it doesn’t and you can set the value to whatever it is you want.


@s.jager Thanks for replying.

I’m using Desktop 2022.2. In the AttributeManager , there is an Attribute Value field, click on the drop down arrow and then choose  ‘Conditional Value’

 

 

Btw, I resolved my issue by introducing the following in my Condition

 

 


@s.jager Thanks for replying.

I’m using Desktop 2022.2. In the AttributeManager , there is an Attribute Value field, click on the drop down arrow and then choose  ‘Conditional Value’

 

 

Btw, I resolved my issue by introducing the following in my Condition

 

 

Where you set the Operator to “Contains Regex” in the conditional statement, you could change it to “Type Is”. With the Operator set to “Type Is” you can then set the Right Value to “Numeric”


Where you set the Operator to “Contains Regex” in the conditional statement, you could change it to “Type Is”. With the Operator set to “Type Is” you can then set the Right Value to “Numeric”

Ha! Never saw that before. Have used the conditional values in the AttributeManager quite  a lot, but never noticed the “Type Is” option there before. I need to remember that, that could be very useful. Never stop learning :-)

I‘d probably still opt for the AttributeValidator, because to me this is more about validation of data, so semantically that would make more sense to me in the workspace as a whole. But I guess that is largely personal preference (I like to build self-documenting workspaces 😉 ).


Where you set the Operator to “Contains Regex” in the conditional statement, you could change it to “Type Is”. With the Operator set to “Type Is” you can then set the Right Value to “Numeric”

Ha! Never saw that before. Have used the conditional values in the AttributeManager quite  a lot, but never noticed the “Type Is” option there before. I need to remember that, that could be very useful. Never stop learning :-)

I‘d probably still opt for the AttributeValidator, because to me this is more about validation of data, so semantically that would make more sense to me in the workspace as a whole. But I guess that is largely personal preference (I like to build self-documenting workspaces 😉 ).

Yes, I would tend to agree with that. If the goal is data validation it would make more sense to use the AttributeValidator. I like using the conditional Type Is inside the AttributeManager when I am less worried about validating or categorizing the data as right/wrong, instead trying to clean up or identify the values all in one stream. Typically creating new attributes that detail the type of other attributes, using the conditional to assign values to that new attribute.


Reply