Skip to main content
Question

Replace missing values in all attributes (dynamic input)

  • November 26, 2019
  • 4 replies
  • 662 views

Forum|alt.badge.img

I would like to replace all <missing> values with a default value. Incoming attributes are not known before (dynamic input).

NullAttributeMapper should solve this problem, but the option "map: all attributes" does only exist for Null and Empty values.

Do you know another helpful transformer or workaround?

Thanks for your comments.

 

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.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 27, 2019

What defines that an attribute is missing?


sigtill
Supporter
Forum|alt.badge.img+25
  • Supporter
  • 956 replies
  • November 27, 2019

Hi @hedigerm

The NullAttributeMapper should work as long as you have all attributes defined in the schema. Make sure in the step before the NullAttributeMapper that all the attributes you need are shown when you click the arrow. Add a Logger to see which attributes are on the first feature - and then copy-paste that feature here and describe the problem a bit more detailed.


david_r
Celebrity
  • 8394 replies
  • November 27, 2019

I agree with @ebygomm, the behavior is explained by the fact that you cannot know that an attribute is missing unless you expect it to be present. And the point of the dynamic schema is exactly that you don't really know what to expect :-)


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 27, 2019

I have in the past used some python to set missing attributes to zero, but my workflow had already defined what attributes needed to be present each time, so I used something like the following to set any missing attributes to zero

    schema = feature.getAttribute('list{}.name')
    attrNames = feature.getAllAttributeNames()
    for i in schema:
        if i not in attrNames:
            feature.setAttribute(i, 0)