Skip to main content
Question

What transformer to use to map multiple attributes?

  • January 8, 2016
  • 3 replies
  • 68 views

tfcw
Contributor
Forum|alt.badge.img+1

I'm reading from a dataset that represents boolean values as a "-1" for true and a "0" as false. I'm attempting to write these values into a dataset that represents booleans as a "Y" for true and a "N" for false.

I can make the "-1" -> "Y", "0" -> "N" conversion by using the AttributeValueMapper transformer, but that only works for one attribute at a time. The source dataset has about 20 boolean fields, so creating a transformer for each of those would be a time consuming and tedious process. I was wondering if there was some transformer I could use to map all these boolean values at once, or if there was a whole different approach I could take.

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

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • January 8, 2016

I would go with two StringReplacers.

 

 

You select which attributes to apply them to, one for the -1 => Y, and the other for the 0 => N

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • January 8, 2016

The StringReplacer would be the easiest way to go. That one works for multiple attributes. You would need two (one for True and one for False):

Even nicer would be to use the SchemaMapper, but that takes a little more to configure.


tfcw
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • January 8, 2016

I would go with two StringReplacers.

 

 

You select which attributes to apply them to, one for the -1 => Y, and the other for the 0 => N

Thanks, this works wonderfully