Solved

Moving file after reading from CSV Reader


Badge

Hello Guys,

 

I am reading a csv file through a CSV Reader and loading the contents in another excel file placed at different location. Finally the source file is supposed to be moved to another location inside the same workbench but i am unable to do so with the help of FileCopy Writer as the CSV reader creates a lock on the file which doesn't allow its moving. It merely copies it without showing any error. Can anybody suggest an another way around?

icon

Best answer by sipsysigh 3 April 2019, 10:27

View original

7 replies

Userlevel 1
Badge +21

What's your current workflow, are you writing to your excel file with a featurewriter and then using this output for the filecopywriter?

Badge

Hi,

It sounds like the workspace hasn't finished with the CSV file before trying to move it. Like @egomm's suggestion I would use the summary output port of the FeatureWriter that writes the Excel File as a trigger to move the CSV file using either another FeatureWriter or a FileCopyWriter. This will ensure that the CSV file will have been closed before the workspace tries to move it.

Simon

Badge

What's your current workflow, are you writing to your excel file with a featurewriter and then using this output for the filecopywriter?

 

This is the workflow.

Userlevel 1
Badge +21

You want the workflow to continue from the FeatureWriter Summary port

Do you need to access the attributes from the attribute manager, I'd presumed if you just wanted to move the file you are reading you can fetch the csv filename via the parameter and manipulate that for the filecopy writer.

If for some reason that is not appropriate, then you still want to connect from the summary port, but then use a featuremerger to merge the attributes onto that output. This merging will prevent the flow progressing further until the writing (and therefore the reading) is finished.

Userlevel 1
Badge +21

 

This is the workflow.

You want the workflow to continue from the FeatureWriter Summary port

Badge

What's your current workflow, are you writing to your excel file with a featurewriter and then using this output for the filecopywriter?

Hi @egomm. Actually i also wish to manipulate the column names and their features coming just before the feature writer after the feature writer. But the feature writer builds some column names like _feature_type.count and .name etc. Hence the destination folder dataset which i am trying to retrieve from the flow after feature writer cannot be build. Hence the File Copy writer isn't working and giving error as File Copy Writer: Cannot create destination folder '\\Archive\\'

where archive is the folder i wish to move my file to

Badge

Hi @egomm. Actually i also wish to manipulate the column names and their features coming just before the feature writer after the feature writer. But the feature writer builds some column names like _feature_type.count and .name etc. Hence the destination folder dataset which i am trying to retrieve from the flow after feature writer cannot be build. Hence the File Copy writer isn't working and giving error as File Copy Writer: Cannot create destination folder '\\Archive\\'

where archive is the folder i wish to move my file to

Hi,

You need to make sure that the attribute value that you are creating / using for the filecopy_dest_dataset is the full path to the destination folder. I think you may have this set to just /ARCHIVE/

 

 

As an example, if you wanted to move the file to a folder called ARCHIVE in the temp folder of your C: drive you would use the following path as the attribute value for filecopy_dest_dataset:

 

C:/Temp/ARCHIVE/

Thanks,

Simon

Reply