Aruna,

You'll only be able to update a given value once. So you could string together 
two UpdateRecord processors
in a row, or in this specific case you could instead use a replaceRegex 
function, such as:

/NUMBER_OF_PRESCRIBERS = replaceRegex(/NUMBER_OF_PRESCRIBERS, '[,-]', '')

Thanks
-Mark

On Dec 20, 2017, at 2:44 PM, Aruna Sankaralingam 
<[email protected]<mailto:[email protected]>>
 wrote:

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:[email protected]]
Sent: Wednesday, December 20, 2017 10:41 AM
To: [email protected]<mailto:[email protected]>
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:[email protected]]
Sent: Thursday, December 14, 2017 12:00 PM
To: [email protected]<mailto:[email protected]>
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 
<[email protected]<mailto:[email protected]>>
 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>

Reply via email to