Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

UpdateRecord processor changes the output of flow file into only nulls

avatar
Rising Star

Hi all.

I have two avro-binary types of flow files and their content is:

Flow file one:
[ {
"DepartmentID" : "Undefined",
"Name" : "Non Billable",
} ]

 

Flow file two:[ {
"DepartmentID" : "Null",
"Name" : "Tax",
} ]

I am using UpdateRecord processor to add a key:value (tenantId) in the same file for which I am using below avro schema:
{
"name": "nifi",
"type": "record",
"fields": [
{ "name": "TenantId", "type": ["null","string"] },
{ "name": "DepartmentId", "type": ["null","string"] },
{ "name": "Name", "type": ["null","string"] }
]
}

I am using literal value replacement value strategy and getting TenantId from previous processors. So far, this is a success and tenantId is appended. However, as a result, the DepartmentId changes to null for BOTH the files. Where I can ensure that the DepartmentId's values are not changed because based on these values, I have to route the "undefined" file for further processing. 


Any help would be appreciated. Thanks. 

3 REPLIES 3

avatar

@Kiranq,

What did you configure in UpdateRecord? Most likely you problem starts from there.

avatar
Rising Star

I am reading avro flow flow (using embedded schema) and for writing it,  I am providing schema.text.

Kiranq_0-1697712811302.png

My schema text is this:
{
"name": "nifi",
"type": "record",
"fields": [
{ "name": "TenantId", "type": ["null","string"] },
{ "name": "DepartmentId", "type": ["null","string"] },
{ "name": "Name", "type": ["null","string"] }
]
}

The issue is its not retaining DepartmentID as strings and converting them to null. 

avatar
Rising Star

I resolved the issue. I had DepartmentId in my avro schema however, I was getting DepartmentID in the input. Schemas are case sensitive.


Now, that the string values are appended in the DepartmentID column, I am using RouteOnContent processors and using ${DepartmentID:equals('Undefined')} to match if the DepartmentID' values are of undefined or null type. It is not identifying the "Undefined" values. is the regex statement correct?

Content of flow file is:
[ {
"TenantId" : "FF369226-0EDA-4D0D-B48C-6B27F404ECCB",
"DepartmentID" : "Undefined",
"Name": "xyz"
} ]