Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have few text files that gets generated everyday. Header of files gets generated every single time (hence it is not "Zero" in size) however weekend files dont have any data in them. I want to merge those files into 1 file for each.....
Need help writing script.
temptable:
Load 0 as field1 autogenerate 0;
For each vFile in FileList('temp2016*.txt')
if file is greater then 1 record then
concatenate (temptable)
otherwise don't concatenate and move on to next file.
May be this?
temptable:
Load 0 as field1 autogenerate 0;
For each vFile in FileList('temp2016*.txt');
If NoOfRows('$(vFile)') > 0 Then
Load '$(vFile)' as Field2;
Else If
Concatenate (template)
Load '$(vFile)' as Field2;
Else
Trace 'Error on Script';
I could probably work up a suggestion. But first question, what is the problem with loading a zero row file in your concatenate?
-Rob
May be this?
temptable:
Load 0 as field1 autogenerate 0;
For each vFile in FileList('temp2016*.txt');
If NoOfRows('$(vFile)') > 0 Then
Load '$(vFile)' as Field2;
Else If
Concatenate (template)
Load '$(vFile)' as Field2;
Else
Trace 'Error on Script';