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