Gateway Activity - no records

Situation:

We have a pre-process flow that will get data based on a field being equal to another field. It will moved the data from the iSeries DB to an XML format to a shared drive on a server. If there is no data, it still creates a file. I have tried to add a decision block and check for a field from the file to be not equal 0 but it still creates them. Suggestions? Because if we have a blank file, the next item is looking for the file to exist; therefore, this will cause issues.

 

Solution:

  1. Use a Gateway activity after the Database Source Activity.

  2. Connect the output sequence flow from the gateway to the next activity.

  3. Connect the output default sequence flow from the gateway to the end event.

  4. Click on the output sequence flow and then click on Edit Condition in the properties.

  5. Now select the Condition Type as Java Condition.

  6. Provide the below Java Condition:

    String Count = (String) context.get("Service.DataBaseSourceName.OperationCount");
    if(Count.equals("0"))
    return false;
    else
    return true;

The above steps will check the number of records and if there are zero records then it will not create a file at the target location. Otherwise if records is not equal to zero it will create the file at the target location.

Have more questions? Submit a request

0 Comments

Article is closed for comments.