Support Questions
Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

NiFi - Expression Language - checking attribute-content JSONpath date

Expert Contributor

Within a flow there have to be checked some things by making an InvokeHTTP returning the response in an attribute (RESPONSE).

The content of this attribute looks like this (note: there can be as many entries):


Now there are two things to check:

1. Does at least one entry "datbis" have equal null?

2. Does at least in one entry "datbis" be greater or equal todays date?

Check 1 can be done with

${anyDelineatedValue("${RESPONSE:jsonPath('$..datbis')}", ","):contains("null")}

Check 2 I can't finde a solution. Tried with spooky things like

${anyDelineatedValue("${RESPONSE:jsonPath('$..datbis'):toDate('yyyyMMdd'):format('yyyyMMdd')}", ","):ge(${now():format("yyyyMMdd")})} but it went wrong.

'Cannot parse attribute value as a date; date format: yyyyMMdd; attribute value: ["20190630","20191231","20190715"]'

Could someone please provide some help?


Expert Contributor

Because I can't find a solution for above problem I created with UpdateAttribute an attribute TEST_DAT with ${RESPONSE:jsonPath('$..datbis')}

The content ist: ["20190630","20191231","20190715"]

Does someone know how I can now take every single entry, convert it to date and compare ge($now():format("yyyyMMdd"))? At least one entry has to fullfil this condition.

Maybe there ist some help for this approach?