Skip to main content
Solved

Split a column into two

  • February 13, 2022
  • 8 replies
  • 280 views

Forum|alt.badge.img

Newbi question, if i have a table where i want to splitt a collumn into two how woud I do that.

 

Existing format

Column a , Column B, Column C

Index,0,0

2022-01,100,245

2022-02,101, 145

2022-03, 90, 200

North,0,0

2022-02,23, 123

2022-03,35,250

South,0,0

2022-01,87,100

 

Now I need to isolate the column a and the heading values, Index, North, South and make a new column

Column a , Column B, Column C, New Column

Index,0,0,index

2022-01,100,245, index

2022-02,101, 145, index

2022-03, 90, 200, index

North,0,0, north

2022-02,23, 123, north

2022-03,35,250, North

South,0,0, South

2022-01,87,100, South

 

The source can be an excel or a db table. Target is a db table

How do I do that?

Best answer by chrisatsafe

Hi @danketil​ ,

 

Just to make sure I have this right, essentially you want to take the value from Column A and set it on the following columns until it changes from Index to North/South/etc?

2022-02-14_13-46-23 If so, you can get this done using the adjacent feature handling feature in the AttributeManager. Since adjacent feature handling requires the attribute to already exist, you'll first need to use an AttributeCreator or AttributeManager to create column D. Then, in an AttributeManager set the number of prior features to 1 and set the following conditional value for column D.

2022-02-14_14-02-57I've attached a sample workspace and dataset in case that helps. From there, you can write it out to whatever format you'd like. Simply type the name of the format or use the add writer button and connect it to the AttributeManager.

 

Output:

2022-02-14_14-06-45

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

8 replies

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • Best Answer
  • February 14, 2022

Hi @danketil​ ,

 

Just to make sure I have this right, essentially you want to take the value from Column A and set it on the following columns until it changes from Index to North/South/etc?

2022-02-14_13-46-23 If so, you can get this done using the adjacent feature handling feature in the AttributeManager. Since adjacent feature handling requires the attribute to already exist, you'll first need to use an AttributeCreator or AttributeManager to create column D. Then, in an AttributeManager set the number of prior features to 1 and set the following conditional value for column D.

2022-02-14_14-02-57I've attached a sample workspace and dataset in case that helps. From there, you can write it out to whatever format you'd like. Simply type the name of the format or use the add writer button and connect it to the AttributeManager.

 

Output:

2022-02-14_14-06-45


danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • February 15, 2022
chrisatsafe wrote:

Hi @danketil​ ,

 

Just to make sure I have this right, essentially you want to take the value from Column A and set it on the following columns until it changes from Index to North/South/etc?

2022-02-14_13-46-23 If so, you can get this done using the adjacent feature handling feature in the AttributeManager. Since adjacent feature handling requires the attribute to already exist, you'll first need to use an AttributeCreator or AttributeManager to create column D. Then, in an AttributeManager set the number of prior features to 1 and set the following conditional value for column D.

2022-02-14_14-02-57I've attached a sample workspace and dataset in case that helps. From there, you can write it out to whatever format you'd like. Simply type the name of the format or use the add writer button and connect it to the AttributeManager.

 

Output:

2022-02-14_14-06-45

Great Job @chrisatsafe​ 


Forum|alt.badge.img
  • Author
  • February 16, 2022
chrisatsafe wrote:

Hi @danketil​ ,

 

Just to make sure I have this right, essentially you want to take the value from Column A and set it on the following columns until it changes from Index to North/South/etc?

2022-02-14_13-46-23 If so, you can get this done using the adjacent feature handling feature in the AttributeManager. Since adjacent feature handling requires the attribute to already exist, you'll first need to use an AttributeCreator or AttributeManager to create column D. Then, in an AttributeManager set the number of prior features to 1 and set the following conditional value for column D.

2022-02-14_14-02-57I've attached a sample workspace and dataset in case that helps. From there, you can write it out to whatever format you'd like. Simply type the name of the format or use the add writer button and connect it to the AttributeManager.

 

Output:

2022-02-14_14-06-45

chrisatsafe

Sorry for my late reply, yes that is correct


Forum|alt.badge.img
  • Author
  • February 16, 2022

I tried your solution but it only works for the first row, it does not replicate the value Index for all rows


takashi
Influencer
  • February 16, 2022
danketil wrote:

I tried your solution but it only works for the first row, it does not replicate the value Index for all rows

Hi @danketil​ , I got this table from @chrisatsafe​ 's workspace. Isn't this your desired one?​

result


Forum|alt.badge.img
  • Author
  • February 17, 2022

imageThis is how the model now looks

and below you find the dataset from query

imageAs you can see it is correct for the first row but it does not apply teh rule for the rest of the rows


takashi
Influencer
  • February 17, 2022
danketil wrote:

imageThis is how the model now looks

and below you find the dataset from query

imageAs you can see it is correct for the first row but it does not apply teh rule for the rest of the rows

Your conditional value setting seems to be wrong. I think it should look like this.conditional-value-setting


Forum|alt.badge.img
  • Author
  • February 18, 2022

Thanks I figured out what I did wrong. Now it works.


Reply


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