Is it possible to check existence of data in data flow?

How-to(s), solutions to common problems, pearls of wisdom

avackova
Posts: 841
Joined: Fri Jul 20, 2007 9:28 am

Is it possible to check existence of data in data flow?

Postby avackova » Mon Mar 08, 2010 9:45 am

Is it possible to check the non-existence of data? For example, I might want to raise an error if no data is received in a flow.

avackova
Posts: 841
Joined: Fri Jul 20, 2007 9:28 am

Re: Is it possible to check existence of data in data flow?

Postby avackova » Mon Mar 08, 2010 9:49 am

You can check number of processed records in all components with transformation, you write by yourself - in finished() method. If your counter is still on initial
value you can just raise an error (raise_error function in ctl), eg. put a Reformat between other components:

Code: Select all

//#TL
int counter = 0;
// Transforms input record into output record.
function transform() {
   counter++;
   $0.* := $0.*;
}

// Called after the component finishes.
function finished() {
   if (counter == 0) raise_error("Input flow is empty");
}
Agata Vackova
Javlin a.s.
agata.vackova@javlin.eu


cron