Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NiFi - Expression Language - checking attribute-content JSONpath date

Highlighted

NiFi - Expression Language - checking attribute-content JSONpath date

Rising Star

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):

[{"id":"(1208)","datbis":"20190630"},
{"id":"(1210)","datbis":"20191231"},
{"id":"(1212)","datbis":null}]


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?

1 REPLY 1

Re: NiFi - Expression Language - checking attribute-content JSONpath date

Rising Star

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?

Don't have an account?
Coming from Hortonworks? Activate your account here