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

Userlevel 4
Badge +30

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

Badge +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.

Badge +22

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

 

Badge +22

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.
Userlevel 2
Badge +17

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

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

 

Badge +22

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.

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 !

 

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 !!

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 !!

Badge +22

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

 

 

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 ?
Badge +22

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.

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

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 !!

Badge +3

@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

 

 

Badge +3

@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

Reply