Page 1 of 1
Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:14 pm
by vinnusea
Hi all,
I have a process (B) which is called from Process (A). Process (A) have a while loop which is calling Process(B) for each iteration and passes single version each time it was called.
Process(B) is creates a view for passed version and exports that view to a TXT file.
Issue:
When ever the process (B) executes itis overwriting the TXT file. There is any way for me to increment the output file instead of overwriting ?
I tried alternatives like creating a bulk view with all the versions and publish but the view would be different for each version. It would be a painful job to create dynamic publish based on the version it is reading. So am looking into any easier way if i could just incitement already existing TXT /CSV file , which would be an ideal solution it seems.
Thanks for taking time.
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:28 pm
by declanr
If you are writing to an output file with a static name it will always overwrite it...
Just concatenate the file name with whatever parameter you are passing in. That way you know what the file contains from the name of it as well.
If you absolutely need it to be in just 1 file then you need to go with your original method of 1 huge view or build all the separate outputs then combine them using vb (possibly started from the command line.)
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:31 pm
by vinnusea
Hi declanr,
Thanks for the reply. Ya i thought so but the file i generate is used by other ETL tools to load it to other systems. So i should be keeping my file name constant. Any other alternatives i can try off?
Thanks
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:38 pm
by Alan Kirk
vinnusea wrote:Hi declanr,
Thanks for the reply. Ya i thought so but the file i generate is used by other ETL tools to load it to other systems. So i should be keeping my file name constant. Any other alternatives i can try off?
You generate all of the original files with unique names. Then you execute a batch file to merge them together as discussed in
this thread on Stack Exchange. The merged file (with its constant name) is the one that you feed to the other ETL tools.
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:40 pm
by vinnusea
Thanks that sounds a doable solution.. Appreciate for quick response...
Thanks
Vinnusea
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 9:52 pm
by declanr
Or just to throw 1 more idea into the mix that removes the necessity to do any work outside of tm1.
Instead of doing an output on each pass, just build up a 2d cube with a single output of that temp cube at the end.
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 11:13 pm
by vinnusea
Hi Rodger,
I created batch files to merge all the versions output txt's into single file and its working. To keep everything in TM1 side , are you advising to dump my output data into a 2D cube? and just export this 2D cube out?. Looks cleaner..
My output could be about 9Million rows ... taking the size of output of my file, would that be too much to load to a 2D cube in TM1?
-Thanks..
Re: Increment Output Txt or CSV file
Posted: Mon Feb 03, 2014 11:18 pm
by failurehappening
You could always use a command line operator to write to the end of a file ( echo >> ) instead of asciioutput, as described by Robin here:
http://www.tm1forum.com/viewtopic.php?f ... 705#p45705