do not write to text file when zero records

Support for DataSlave

Moderators: Tom, ian

do not write to text file when zero records

Postby nicka » Fri Nov 04, 2011 12:35 pm

I have a mapping that writes data to a text file.
only records which evaulate to 'true' in a 'validate' object are passed to the 'write to text file' object but on occasion there are no records.
regardless records or not, the text file is still created.
this text file is then identified by another 3rd party program and processed elsewhere.
is there some way so that no file is created when there are no records ? Maybe an option in the export to text file object or something in the validate mapping to stop processing if zero records ?

currently I have to use a messy workaround in the 3rd party program to check the file size of the csv file but its not 100% accurate.

thanks,
Nick
nicka
 
Posts: 4
Joined: Mon May 22, 2006 11:55 am

Re: do not write to text file when zero records

Postby ian » Sat Nov 05, 2011 11:09 pm

Yes, the output file will always be created. It would be possible to use a map-level .NET script object to use some C# script to manage this.

A second approach is to use DataSlave Loader to execute the map. The value returned when the map executes is the number of rows passed by the final object. The command file that call the loader could then rename the file to the name your application looks for only if the returned value is non-zero. Please have a look at: http://www.baycastle.co.uk/V2/DataSlave ... Loader.htm
ian
 
Posts: 364
Joined: Sat Dec 18, 2004 8:13 am
Location: UK


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron