Skip to main content
Question

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

  • November 24, 2022
  • 10 replies
  • 182 views

smfks911

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

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • November 24, 2022

Hi @smfks911​ 

 

Please, could you share your Workspace?

 

Thanks in Advance,

Danilo


smfks911
  • Author
  • 46 replies
  • November 24, 2022

Hi @smfks911​ 

 

Please, could you share your Workspace?

 

Thanks in Advance,

Danilo

Hi @danilo_fme​ , here is my workspace.

Thanks.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • November 25, 2022

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


smfks911
  • Author
  • 46 replies
  • November 25, 2022

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.


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • November 25, 2022

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


smfks911
  • Author
  • 46 replies
  • November 25, 2022

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


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • November 25, 2022

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.


smfks911
  • Author
  • 46 replies
  • November 25, 2022

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​ 


caracadrian
Contributor
Forum|alt.badge.img+23
  • Contributor
  • 571 replies
  • November 25, 2022

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


smfks911
  • Author
  • 46 replies
  • November 25, 2022

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.