Skip to main content
Solved

Process CSV file pairs

  • July 29, 2025
  • 3 replies
  • 61 views

goatboyboz
Contributor
Forum|alt.badge.img+5

Hi All,

I have a folder of csv files with the naming convention like this : Insp1.csv, Obsv1.csv, Insp2.csv, Obsv2.csv etc etc.

I have written a workbench to read in Insp1.csv and Obsv1.csv and derive the outputs i want. These csv files are pairs and both are needed to create the output. 

I have a folder of many InspX.csv and ObsvX.csv files that I want to process. 

I have set up a Directory and File Pathnames reader than I think I want to pass into a workspace runner that calls the workbench to process the files with parameters.  How to I get FME to iterate over my files and each time the runner is called iterate to the next pair of csv’s? ie first time is run use Insp1.csv and Obsv1.csv, the second time use Insp2.csv and Obsv2.cvs etc etc

Many Thanks Goatboy

Best answer by nielsgerrits

In the child workspace, you need published parameters for the filepaths.

In the parent workspace, one you select the child workspace in the workspacerunner, you can point attributes to the published parameters. The Directory and File Pathnames reader outputs path_windows which has the path to the file.

In the parent you can build stuff to check for the two files to exist, use your imagination.

Attached sample workspace.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+61

One way to do this is to use the Directory and File Pathnames FeatureReader, read the directory with files as features and use these as initiators for the workspacerunner.


goatboyboz
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • July 29, 2025

One way to do this is to use the Directory and File Pathnames FeatureReader, read the directory with files as features and use these as initiators for the workspacerunner.

Thanks Niels, i think I'm missing something here. How does fme know which pair of files to use? ie 1 and 1, then 2 and 2 etc ? Could you please elaborate a bit for me.  thanks 


nielsgerrits
VIP
Forum|alt.badge.img+61
  • Best Answer
  • July 29, 2025

In the child workspace, you need published parameters for the filepaths.

In the parent workspace, one you select the child workspace in the workspacerunner, you can point attributes to the published parameters. The Directory and File Pathnames reader outputs path_windows which has the path to the file.

In the parent you can build stuff to check for the two files to exist, use your imagination.

Attached sample workspace.