Hi Vibhath,

I could be completely wrong here. Apologies in Advanced if I am!

What is the value of the field before the Update Record processor? It seems 
like it's an empty string? How do you have the CSV Reader Configured?

Is this reader used anywhere else in the flow? If so, does it error, there too?

Based on the limited logging shared, I don't think the Update Record has even 
got round to working on the field, I think the CSV Reader hasn't even been able 
to read the file correctly and is erroring.

Out of Curiosity, Have you tried setting the default value to null on the 
reader schema?

Are there any further logs for this error, if so, are you able to share?

Kind Regards,

Nathan

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Vibhath Ileperuma <[email protected]>
Sent: Sunday, July 31, 2022 8:49:04 AM
To: [email protected] <[email protected]>
Subject: Multiplying a record filed value by a constant

Hi All,

I'm using Nifi's expression language with 'Update Record' processor to multiply 
an integer value in a record path by a constant. Note that my input is a csv 
file and I'm providing the schema through a Avro schema registry. This filed 
I'm using is specified as a nullable filed in the schema as below and this 
filed is null in some records.
        {
            "type": [
                "long",
                "null"
            ],
            "name": "Insert_Timestamp"
        }

What I want do is to multiply the filed value when it is not null and do 
nothing when it is null.

When I simply multiply the value as below, it throws an error when the value is 
null.
${field.value:multiply(1000000)}

Hence I tried to use a null check and a IfElse before multiplying as below.
${field.value:isNull():ifElse(${field.value} , 
${field.value:multiply(1000000)})}

Then also I'm getting an error when the value is null.

UpdateRecord[id=01821014-6ce9-14b9-4604-6eea727a933b] Failed to process 
StandardFlowFileRecord[uuid=abd624d4-d571-49c8-9b1a-5e171b487e33,claim=StandardContentClaim
 [resourceClaim=StandardResourceClaim[id=1659246191387-1, container=default, 
section=1], offset=0, length=23202895],offset=0,name=abc.csv,size=23202895]; 
will route to failure: For input string: ""


Could you please let me know whether there is a way to mutiply the record only 
if it is not null.

Thank You.

Best Regards,

Vibhath Ileperuma.

Reply via email to