Skip record in datamapper missing a XML node

I have a XML based datamapper and need to skip records if a xml node which build a detail table is missing or if there is a specific value in one of the fields in the detail table.

I sort of have working but wondering if there is a better method?
I don’t know that the specific value in one of the fields will always be the first detail record

image

image

image

image

You could use XPATH’s count() function to determine if there are as many _vger_record_id elements as there are Flex_Input elements.

Left operand’s XPATH:
count(./record/Flex_Input/_vger_record_id)
Right operand’s XPATH:
count(./record/Flex_Input)

If a single _vger_record_id element is missing, both totals will be different.

Your second condition can also use the count() function to determine if any REPORTING_NAME element contains a specific value:

Left operand’s XPATH:
count(/record/Flex_Input[REPORTING_NAME="some specific value"])

If that XPATH returns 0, no element matches that specific value.

1 Like

I was able to get the second one to work, but not the first one.

However reviewing assuming that the [REPORTING NAME = “****”] does not exist, I don’t want to keep the record. The first condition would not be necessary anyway.

The count is much better because I don’t necessarily know that [REPORTING NAME = “****”] will always be the first record in the detail table. Even though it is supposed to be some of the rules appear to be incorrect and not always applied.

Is there anyway to log what is skipped?

Sure. In the Action Step (where you skip the record), add a Javascript action that uses logger.info("something to log") and position it before the action that skips to the next record.

1 Like