Question

How to add an attribute in files exposed by File and Path directory transformer?


pathDirectoryissueDear Altruist, I have a consistent series of excel files but saved under different folder in respect to model_run no. Now I would like to add a column in each of the excel files as per the folder name that file is situated in. I have used 'Directory and File Path' transformer to expose all those excel file and used stringsearcher to create a column that extracted the folder name from the path. Can anyone please tell me how can I add the folder name as an attribute to the individual excel file?

regards/

 

 


10 replies

Userlevel 4
Badge +30

Hi @smfks911​ 

 

Please, could you share your Workspace?

 

Thanks in Advance,

Danilo

Hi @smfks911​ 

 

Please, could you share your Workspace?

 

Thanks in Advance,

Danilo

Hi @danilo_fme​ , here is my workspace.

Thanks.

Badge +20

If you want the new filename to be something like Run_0190_PP_BAU.xlsx you can just use an AttributeManager to set the value of path_filename to @Value(RunNo)_@Value(path_filename).

Concatenate attributes

If you want the new filename to be something like Run_0190_PP_BAU.xlsx you can just use an AttributeManager to set the value of path_filename to @Value(RunNo)_@Value(path_filename).

Concatenate attributes

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

Badge +20

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

Then send to FeatureReader, set Attribute and Geometry Handling -> Accumulation Mode to Merge Initiator and Result and send to an ExcelWriter

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

hi @caracadrian​, in that case do you think I should path_dir_windows as the dataset or path_filename? can you see the attached?excelAccumulation

Badge +20

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

path_windows to read a file.

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

Unfortunately, this is not returning what I am looking for. If you can afford time, I would like to have a one to one discussion with you. Thank you @caracadrian​ 

Badge +20

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

That sounds good.

We can do it tomorrow or on Monday. I'm on UTC+2 (EET). You can email me at carac.adrian@gmail.com

Hi @caracadrian​ Thanks mate but this is not the thing I am looking for. I am actually after adding a new column in each of those excel files that are exposed in path_filename.

Thank you so much. I have just shoot an email to you.

Reply