Reputation: 43
I'm trying to create a filename dynamically. I'm able to get the date but i need the rowcount of the data that was read from the odbc source.
I created a int32 variable called 'rowcount'. And in the expression for the flat file connection manager 'connection string' property I have the following:
"E:\\path\\" + (DT_WSTR,4)DATEPART("yyyy",GetDate()) + RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + RIGHT("0" + (DT_WSTR,2)DATEPART("dd",GetDate()),2) + "_" + (DT_WSTR, 20) @[User::rowcount] +".csv"
which gives :
E:\folderpath\20151218_0.csv
But when I run the project it is creating the file name with 0 instead of the row count.
Any help would be appreciated. Thanks.
Upvotes: 0
Views: 776
Reputation: 31775
Ok, the problem is that your flat file is getting created (and therefore, named) before your DataFlow runs, when your rowcount variable is still zero because it hasn't been populated yet.
The only way to handle this is to rename the flat file after you have populated it and gotten the rowcount. And the only way to do this is with a Script Task that runs after your DataFlow task.
Upvotes: 1