Transform Maps Remove comma for on insert to string field

grace_alvarado
Kilo Explorer

I am importing data to one of my tables, however, there is one field that created as a string and when importing numbers I am getting a comma.   How do we get rid of the comma when using this transform map?   This is a map we will be using constantly and I need the comma to be removed.

1 ACCEPTED SOLUTION

Graciela,



Can you check what is the field type that stores your numeric value in import set table? I guess it must be an integer since the value is numeric. If so, please add the format none attribute to the dictionary of this field in import set table. Once you have added this, all the commas will be ignored then you can do the transform.



In case the import set table field also a String then you can try adding the below piece of code in the Script part of your Transform Map.



target.<string_field_name_in_target_table> = source.<string_field_name_in_import_set_table>.toString().replace(/,/g,'');



Try and let me know.


View solution in original post

4 REPLIES 4

guhann
Mega Guru

Hi Graciela,



In the dictionary definition of the string field you mentioned under the related list 'Attributes' add a new attribute of Format and set it's value as none. This will remove the comma being added to the numeric value.


grace_alvarado
Kilo Explorer

I attempted this but when looking at the Dictionary Attributes wiki article the target element is for any numeric field such as integer or glide-date.   The field I am importing a number to is a string.   When running my transform map it still adds the comma.


Graciela,



Can you check what is the field type that stores your numeric value in import set table? I guess it must be an integer since the value is numeric. If so, please add the format none attribute to the dictionary of this field in import set table. Once you have added this, all the commas will be ignored then you can do the transform.



In case the import set table field also a String then you can try adding the below piece of code in the Script part of your Transform Map.



target.<string_field_name_in_target_table> = source.<string_field_name_in_import_set_table>.toString().replace(/,/g,'');



Try and let me know.


I had figured it out as well.   Thank you for your reply.



You are correct.   I was putting the attribute on the wrong table.   Once I created the temporary import table and added the attribute to the temporary table's field it corrected the issue.



And thank you for the script that will also be handy to test out as well.