Skip to main content
Solved

Create a column with values from another column


salvaleonrp
Enthusiast
Forum|alt.badge.img+15

Looking for a single transformer solution on this question. I have an ordered list and I'd like to populate Col 2 (group) with values from Col 1 that start with '# '. Since the number of rows for each group is random and the categories are also dynamic I'd like to avoid hard coding the groups as conditional values.

Best answer by ebygomm

You should be able to use adjacent attribute mapping in an attribute creator. Use a conditional statement to set the value of column 2 to equal column 1 if it begins with #, otherwise use the value from the previous features column 2

Capture

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

4 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • March 23, 2021

You should be able to use adjacent attribute mapping in an attribute creator. Use a conditional statement to set the value of column 2 to equal column 1 if it begins with #, otherwise use the value from the previous features column 2

Capture


salvaleonrp
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • March 23, 2021
ebygomm wrote:

You should be able to use adjacent attribute mapping in an attribute creator. Use a conditional statement to set the value of column 2 to equal column 1 if it begins with #, otherwise use the value from the previous features column 2

Capture

Is Col2 in your schema already or created before the AttributeCreator transformer?


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 23, 2021
salvaleonrp wrote:

Is Col2 in your schema already or created before the AttributeCreator transformer?

You don't technically have to create the blank column Col2 in advance to populate, but if you don't you'll get the correct result but a red cog on the transformer.

I think if you have FME 2020 you may be able to create it in the same attribute creator


salvaleonrp
Enthusiast
Forum|alt.badge.img+15
  • Author
  • Enthusiast
  • March 23, 2021
salvaleonrp wrote:

Is Col2 in your schema already or created before the AttributeCreator transformer?

That explains it. I have to manually type the Col2 prior feature attribute because it does not show up on the attribute list even if I enabled Advanced Editing. I did get the red cog and the warming during translation but it ran with correct results. Thanks!


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