Skip to main content

I keep getting an error in my translation because one of the reader attributes is a string (utf-16) and I'm trying to read it into an integer attribute in the writer. But I can't seem to find a way to convert it. I'm sure I've accomplished this in the past but can't remember how and am not seeing anything in the docs about how to do this specifically.

Hi @ieukcoca, generally FME implicitly converts data type of an attribute value if necessary, according to the destination schema you have configured. A string representing digits should be written into an integer type attribute in a destination feature type without any explicit type conversion.

If it's a case where the automatic conversion won't be performed, there could be a kind of bug. Could you please elaborate the situation, including answers to these questions?
  • What error message appeared?

  • What format reader/writer are you using?

  • What version, build number of FME are you using?

Consider inserting an AttributeValidator somewhere to check that the string attribute indeed contains a valid integer, e.g.

You could direct the "Failed" port of the AttributeValidator to an Inspector to check what's going on.

Depending on the output format / FME version it might also be necessary to use a NullAttributeMapper to map any empty strings to proper NULL values before the writer:


@david_r When I use an attribute validator, I get Attribute 'apn' with value '3862110200' fails check for Type is 'INT'

    attributevalidationmessage.png

    @takashi

    • The error I get is: 2018-04-09 09:04:44| 2.7| 0.0|ERROR |The invalid value '3870900800' was supplied to the field 'apn' for the table/feature class 'sde.account_to_apn_match'
    • version FME(R) 2017.1.0.0 (20170731 - Build 17539 - WIN32)
    • The reader is SWORLDSWAF; the writer is GEODATABASE_SDE

    Hi @ieukcoca, the value 3862110200 is greater than the upper limit of 32-bit integer = 2147483647. 'integer' type in the Geodatabase SDE format represents 32-bit integer. Probably it's the reason why the writer rejected writing the value. If so, it's a limitation according to the format specifications, not a defect or a bug of FME.

     

    Try changing data type setting in the writer feature type to one which has enough valid range to save 3862110200. e.g. integer(n) (n=10), double, or double(n, m) (n=10+, m=0)

     


    @david_r When I use an attribute validator, I get Attribute 'apn' with value '3862110200' fails check for Type is 'INT'

      attributevalidationmessage.png

      @takashi

      • The error I get is: 2018-04-09 09:04:44| 2.7| 0.0|ERROR |The invalid value '3870900800' was supplied to the field 'apn' for the table/feature class 'sde.account_to_apn_match'
      • version FME(R) 2017.1.0.0 (20170731 - Build 17539 - WIN32)
      • The reader is SWORLDSWAF; the writer is GEODATABASE_SDE
      Hi @ieukcoca, the value 3862110200 is greater than the upper limit of 32-bit integer = 2147483647. 'integer' type in the Geodatabase SDE format represents 32-bit integer. Probably it's the reason why the writer rejected writing the value. If so, it's a limitation according to the format specifications, not a defect or a bug of FME.

       

      Try changing data type setting in the writer feature type to one which has enough valid range to save 3862110200. e.g. integer(n) (n=10), double, or double(n, m) (n=10+, m=0)

       


      Hi @ieukcoca, the value 3862110200 is greater than the upper limit of 32-bit integer = 2147483647. 'integer' type in the Geodatabase SDE format represents 32-bit integer. Probably it's the reason why the writer rejected writing the value. If so, it's a limitation according to the format specifications, not a defect or a bug of FME.

       

      Try changing data type setting in the writer feature type to one which has enough valid range to save 3862110200. e.g. integer(n) (n=10), double, or double(n, m) (n=10+, m=0)

       

      Thanks @takashi That makes total sense!

       


      Reply