Skip to main content

NullAttributeMapper, AttributeCreator or other

What do people use to set default values for attributes?

In the case that I have is a json document - in the case values are missing I need to set a default value. 

Ideally I’d use an NullAttributeMapper, however, there are upwards of 10 values I need to set and I don’t want to use 10 of these. 

The other option I see is an AttributeCreator/Manager with conditional values which is what I would normally do. 


 

One way I’ve done it in the past when i had a lot of attributes with nulls that each needed a different default value

 

NullAttributeMapper to map all null values to missing

Source data of all attributes with their required default values

FeatureMerger set up to merge defaults onto all data, set to Use Requestor on Conflict Resolution

The attributes set to missing get the default values from the supplier, populated values remain as is.

 

Edit: I think if you set Ignore Nulls to Yes you don’t even need the Null Attribute Mapper step


That’s an intersing approach

so like a Creator>AttribtueCreator to set/define default values>FatureMerger to fill in missing values


In my case, I had a CSV file defining default values, but an AttributeCreator works too. It has the advantage over conditional values that you can easily open it up and see what the default value is set to and change/update/add if necessary.


Also updating multiple conditional values in an AttributeCreator can be time consuming, so if the default values are not fixed, the FeatureMerger route is more convenient. I prefer to have data in sourcefiles, not in workspaces, as this is easier to maintain the conversion process.

Bit off topic but when correcting data, my way of working is to write all unique values to excel, use that as a start for a from-to table, do the edits in excel and then feed that back in the data using a FeatureMerger. Doing these kind of corrections in workbench is way quicker, getting more done in less time.