How: "If every field in doc contains zeroes, do this....."

Below shows a document that I’m receiving

ContactVisitHours
- MonMorningFrom
- MonMorningTo
- MonAfternoonFrom
- MonAfternoonTo
- TueMorningFrom
- TueMorningTo
- TueAfternoonFrom
- TueAfternoonTo
- and on and on and on until Sunday (AfternoonTo)

There are moments when I would get the above and the requirement is that if I receive it and EVERY FIELD contains 000000, I am to execute another service. I cannot execute the service if say only MonMorningFrom contains zeroes. It has to be all the fields or nothing. In case you’re wondering, if zeroes are sent over, it’s always a 6 digit numeric.

For some reason, the only way I can think of at the moment is to branch on the document, then put the below in the sequence step, which looks to be ridiculous to me.

%ContactVisitHours/MonMorningFrom% == 000000 && %ContactVisitHours/MonMorningTo% == 000000 && %ContactVisitHours/MonAfternoonFrom% == 000000 && %ContactVisitHours/MonAfternoonTo% == 000000 && %ContactVisitHours/TueMorningFrom% == 000000 && %ContactVisitHours/TueMorningTo% == 000000 && %ContactVisitHours/TueAfternoonFrom% == 000000 && %ContactVisitHours/TueAfternoonTo% == 000000 && on and on and on until Sunday

There has got to be a better, simpler way and I’m having a brain cramp. Can you please provide an alternative? Thanks.

If it is every field in the document to be checked, perhaps this Java service will work. Not tested!

allFieldsEqual
[highlight=java]
IDataCursor idc = pipeline.getCursor();
IData record = IDataUtil.getIData(idc, “record”);
IData compare = IDataUtil.getIData(idc, “compare”);
boolean isEqual = true; // Assume true until we know otherwise

if(record != null)
{
IDataCursor recCursor = record.getCursor();
while(recCursor.next()) // visit each field in the record
{

    Object value = recCursor.getValue();
    if(value != null)
    {
        if(value instanceof String)
        {
            String s = (String)value;
            if(!compare.equals(s))
            {
               isEqual = false;
               break;
            }
        }
        else // Not null and not a string--some other object
        {
            isEqual = false;
            break;
        }
    }
}
recCursor.destroy();

}

IDataUtil.put(idc, “isEqual”, “”+isEqual);
idc.destroy();[/highlight]