on 05-21-2018 3:23 PM
Hi, I'm unable to read file name from data services which contain date_time format, I can read date but time can be variable, I've tried with *.csv on file name(s) property for flat file, but this for static file name.
Example of files: File_20180520_200003.csv, File_20180519_192503.csv, etc.
My script:
$Filename= 'File_'|| to_char(sysdate()-1, 'YYYYMMDD')|| '_'|| '*.csv';
I want to find a solution to read the 6 digits (any number) *.
Thanks
Thank you for testing my issue.
Finally, I've found a solution by using
$Csv = word(exec('cmd','dir /b [$Filename]*.csv',8),2) ;
on the flat file (file name property), I've added $Csv
It works fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Using your example I created a test job with a global variable called $Filename. The script in the beginning of my job set the variable:
$Filename= 'File_'|| to_char(sysdate()-1, 'YYYYMMDD')|| '_'|| '*.txt';
print($Filename);
I then created a file format and pointed to the local file on my machine named File_20180519_192503.txt so I could import the schema. Note that after I imported the schema then I could really put anything for the filename here like File_111_1.txt. I could have built the schema manually as well.
I added a dataflow after my script and used the file format I just created as the source > double click to open it > change the filename to my global variable $Filename > run the job > completes successfully and loads data to my target temp table.
Best,
Christa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.