Skip to content
+1-888-319-3663

COMMUNITY FORUM

FileName being imported through Map

Madhu asked 5 years ago
I am looking to find the file name being processed in a map, wanted to create a script task after the file processed and archive the file that is processed. Let  me know if it can be done. 
I know someone suggested to loop through the input folder but we can’t get the Filename if there are multiple files and only one file is being processed.
Answers
Patrick Roth Staff answered 5 years ago
“I am looking to find the file name being processed in a map, wanted to create a script task after the file processed and archive the file that is processed. Let  me know if it can be done”

I don’t know why you would need to do that.  Typically if you don’t know the name of your source file, you would use a folder data source.  And as part of the functionality of a folder data source is that SC automatically puts it onto a ‘success” or “fail” folder that you define.
If you aren’t using a folder data source, just a single file, then you’d have to query the smartconnect database to find the name of the source file.  Off the top of my head, i’m not sure which table contains the pathname of the select input file for a map but it going to be the TextFileDataSource table but you’ll have to join in other tables to match up the GUID in that table to the actual map.
Assuming it IS a folder data source – then we don’t know what line belongs to what file if multiple.
So what you could do is vb/C# on a map pre task.
on the map pre task, you could loop though the files in the folder source.  Then read the entire source file.  Then write back to the same file (or a new one) the same data but then also append the source file pathname to the source data.
Now when your integration runs, the pathname of the file is right in the source data like anything else.
 
 
Madhu replied 5 years ago

Thanks for the reply. We have different maps running with the Excel/Text File Source and user can select a File to be processed at run time from a folder which contains multiple files. As you suggested I looked into the database , can get the filename from BulkDatasourcebase and respective datasource type table (TextFileDataSource, Excel2007DataSource,Excel2010DataSource etc).


If you would like to submit an answer or comment, please sign in to the eOne portal.