isEmpty function of RecordPath returns true if the string is empty or null else false.
Using RPATH on nested list in SQL in QueryRecord in NiFi
I have a json
[
{
"orderId": "100",
"orderItems": [
{
"orderItemSeqId": "101",
"externalId": "56789"
},
{
"orderItemSeqId": "102",
"externalId": null
}
]
},
{
"orderId": "200",
"orderItems": [
{
"orderItemSeqId": "201",
"externalId": "78990"
},
{
"orderItemSeqId": "202",
"externalId": "83937"
}
]
}
]
Using QueryRecord processor in NiFi, I wish to select the orders having any item with null externalId.
So, in the output we should have only the first map with "100" orderId as it has one item with null externalId.
I tried this SQL with RPATH but doesn't work:
SELECT *
FROM flowfile
WHERE RPATH_STRING(orderItems, '[*][isEmpty(./externalId)]') = 'true'

