Skip to main content
Question

Create new lines with columns


Hello,

I've a problem with data.

I've a csv file with columns following : « libelle_objectif », « libelle_objectif_2 », « libelle_objectif_3 », « libelle_milieu », « libelle_milieu_2 », « libelle_milieu_3 », « libelle_typtravaux » , « libelle_typtravaux2 », and, « libelle_typtravaux3 ». I would like to reduce the number of columns so that there is just only column « libelle_objectif », « libelle_milieu » and « libelle_typetravaux ». I need to create new lines to include the data of column delete.

In my case, I've this lines following (data1.png) :

I would like to get the lines following (data2.png) :

What process can I to use with FME to transform my data ?

Excuse me for my english.

Best !

 

Togmab

17 replies

danilo_fme
Evangelist
Forum|alt.badge.img+44
  • Evangelist
  • May 14, 2019

Hi @tbtomabagot

Did you try to use the transformer AttributeManager between your Reader and Writer?

Is possible to delete the columns that you want using this transformer.

 

Thanks,

Danilo


Forum|alt.badge.img+2

Hi @tbtomabagot,

 

If you are simply removing columns and do not wish to modify the data in anyway this could also be done directly within the Writer.

Open the Writer and select the User Attributes tab and for the Attribute Definition select 'Manual'. You will now be able to remove the attributes you do not wish to be written by first selecting them and then clicking in the minus button in the bottom left corner of the window.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 14, 2019

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 14, 2019
jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

My first thought is to use a combination of ListPopulator and ListExploder.

 

 

The original attribute names may need to be slightly adjusted before the ListPopulator

 

X, X1 or X_0, X_1 will work

 

X, X_1 will not.

takashi
Influencer
  • May 14, 2019

The resolution of your screenshots (especially data1.png) is too low. Could you please share the raw sample datasets (Excel or CSV files)?


jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

Thank you @jdh !

You have understand my problem.

With the ListExploder I get this :

How can I to add new lines with the same ID and list{1} and list {2} in objectif column ?

Good day !

Thomas

 


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 16, 2019
tbtomabagot wrote:

Thank you @jdh !

You have understand my problem.

With the ListExploder I get this :

How can I to add new lines with the same ID and list{1} and list {2} in objectif column ?

Good day !

Thomas

 

It would be helpful if you posted your workspace with a small sample of the data.


jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

Thank you very much @jdh !!

I add screenshot of my workspace and a data sample : workspace.PNG, sampledata.csv

Have a good day !

 


hollyatsafe wrote:

Hi @tbtomabagot,

 

If you are simply removing columns and do not wish to modify the data in anyway this could also be done directly within the Writer.

Open the Writer and select the User Attributes tab and for the Attribute Definition select 'Manual'. You will now be able to remove the attributes you do not wish to be written by first selecting them and then clicking in the minus button in the bottom left corner of the window.

Thank you @hollyatsafe, but I want to replace data column in new lines.

Have a good day !!


danilo_fme wrote:

Hi @tbtomabagot

Did you try to use the transformer AttributeManager between your Reader and Writer?

Is possible to delete the columns that you want using this transformer.

 

Thanks,

Danilo

Thank you @danilo_fme but I want to replace data column in new lines.

Have a good day !!


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 21, 2019
tbtomabagot wrote:

Thank you very much @jdh !!

I add screenshot of my workspace and a data sample : workspace.PNG, sampledata.csv

Have a good day !

 

Attached is a sample workspace that I think gets where you want to go. You will have to do some attribute cleanup.

 

columnstofeatures.fmwt

 

 


jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

Thank you !

But I can't open your workspace because I have FME2016. There this error message :

How I can use your files with FME 2016 ?

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 22, 2019
tbtomabagot wrote:

Thank you !

But I can't open your workspace because I have FME2016. There this error message :

How I can use your files with FME 2016 ?

I don't have FME 2016, but hopefully this screenshot will help.


jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

Thank you @jdh ! I create a workspace like on your screenshot : for the ListExploder parameters I put this : My result are "missing " :

Why I haven't list create by ListPopulator ?

Have a good day !

Thomas


jdh wrote:

If I understand correctly you have one feature with multiple instances of a column, and you would like to turn that into multiple features, with a unique instance of the column.

 

 

So a simplified version would be

 

ID, Objectif, Objectif_2

 

1, A, B

 

2, C, D

Becomes

ID, Objectif

1, A

 

1, B

 

2, C

 

2, D

 

It's okay I've a result : I hadn't result because I wrote "objectif" and I do write "objectif0". Thank you very much !!


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 24, 2019

@tbtomabagot

 

Hi,

Heres i a workspace that does it. (no cleaning required..;)

Wokr need to make it generic.

A picture addded so you can reacreate it, as the ws is 2018. Just set the parameters as in the SummaryAnnotations.

The transformers named in the error must be replaced by 2016 versions.

Bagot simple but manual.fmw

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 24, 2019

@tbtomabagot

Here is another one.

It has no lispopulator and therefore is easier to make generic. (with loops in custom).

It uses an attributeploder instead.

Bagot no listpopulator.fmw


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