nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aruna Sankaralingam <Aruna.Sankaralin...@Cormac-Corp.com>
Subject RE: Put Database record
Date Wed, 20 Dec 2017 19:44:42 GMT
Should I create another variable like the highlighted one below?

/NUMBER_OF_PRESCRIBERS  = replace(/NUMBER_OF_PRESCRIBERS, ',', '')
/NUMBER_OF_PRESCRIBERS1  = replace(/NUMBER_OF_PRESCRIBERS, '-', '')

From: Aruna Sankaralingam [mailto:Aruna.Sankaralingam@Cormac-Corp.com]
Sent: Wednesday, December 20, 2017 10:41 AM
To: users@nifi.apache.org
Subject: RE: Put Database record

Hi,

I did as you suggested and it worked. If I want to remove or replace more than one character,
can I do it in the same statement?
For ex: I want to replace ‘,’ and ‘-‘ with ‘’ for the same field.

From: Mark Payne [mailto:markap14@hotmail.com]
Sent: Thursday, December 14, 2017 12:00 PM
To: users@nifi.apache.org<mailto:users@nifi.apache.org>
Subject: Re: Put Database record

Aruna,

You would need to remove the commas from the number. The easiest way to do that is probably
to use
an UpdateRecord processor before the PutDatabaseRecord. In that processor, you would want
to use a
schema that either declares the field as a "string" or uses a union like:

{ "name" : "NUMBER_OF_PRESCRIBERS", "type": [ "int", "string" ] }

Then, in UpdateRecord you would add properties such as:

/NUMBER_OF_PRESCRIBERS  = replace(/NUMBER_OF_PRESCRIBERS, ',', '')

That would strip out any commas for you. It looks like you would need to do the same for each
of the fields
here that you are declaring as an "int"

Thanks
-Mark


On Dec 14, 2017, at 11:15 AM, Aruna Sankaralingam <Aruna.Sankaralingam@Cormac-Corp.com<mailto:Aruna.Sankaralingam@Cormac-Corp.com>>
wrote:

I am getting this error when I am trying to load a csv to redshift. I guess its because I
declared that as an INT in AvroSchema and the value has a “,”. If so, how do I make it
accept that as an integer?


<image001.png>



<image002.png>


<image003.png>

Mime
View raw message