Skip to main content

A dynamic workflow from PostGIS to FileGDB Open API contains some boolean attributes. When writing the data, there are warnings stating that the objects containing boolean attributes are skipped.

If I replace the attribute values true/false with 1/0, the objects are written. So, it seems to be that the mapping for the boolean attributes to FileGDB expects an integer instead of a text (the boolean type does not exist in FileGDB).

So, I guess I have 3 questions:

  1. is there another way to keep the objects, because I would like to keep true/false?
  2. is there a way to automatically change the data type in the dynamic writer?
  3. should this be considered as a bug?

 

Hi @Jelle De Zwaef​ 

As per the help document for FileAPI Writer

Data type Logical, bit, or boolean is not supported, thus the data get mapped as smallint(on writer), which can only accept integer values.

WORKAROUND

Use File Geodatabase(ArcObjects)writer (requires a valid Esri license)

To convert the data from True/False or Yes/No to 1/0 dynamically using Python

 

Using dynamic workflow since FME is not aware of the incoming attribute field names we need to use PythonCaller(thanks @debbiatsafe​ ). Please see the attached template as an example, it should convert all the incoming data type boolean to integers. If the incoming attribute does not contain attribute value, the code will map it to NULL.


Hi @Jelle De Zwaef​ 

As per the help document for FileAPI Writer

Data type Logical, bit, or boolean is not supported, thus the data get mapped as smallint(on writer), which can only accept integer values.

WORKAROUND

Use File Geodatabase(ArcObjects)writer (requires a valid Esri license)

To convert the data from True/False or Yes/No to 1/0 dynamically using Python

 

Using dynamic workflow since FME is not aware of the incoming attribute field names we need to use PythonCaller(thanks @debbiatsafe​ ). Please see the attached template as an example, it should convert all the incoming data type boolean to integers. If the incoming attribute does not contain attribute value, the code will map it to NULL.

thank you very much @rahulsharma​ for your quick answer!

I still wonder a little bit why the booleans are converted to a smallint. Often (not always), the value will be true/false, which should be mapped to a string. If the data already contains 0/1, it could still be stored as a text (in contrast to storing text as smallint)


thank you very much @rahulsharma​ for your quick answer!

I still wonder a little bit why the booleans are converted to a smallint. Often (not always), the value will be true/false, which should be mapped to a string. If the data already contains 0/1, it could still be stored as a text (in contrast to storing text as smallint)

Hi @Jelle De Zwaef​ , The datatypes such as bit, logical or boolean for database stores the data as 0 or 1, but are displayed as True or False, Yes or No.

Background:

During translation, FME will do its best to automatically look at incoming data type and set the output to the closest possible. So in your translation, the incoming data is fme_boolean, thus it gets converted to fme_integer

 

If you do not want to store the data as an Integer data type, you can change the output (see below)

  • On the Writer Feature type properties
  • Switch to the "User Attribute" tab
  • Under Attribute Definition, Click on Manual (Now you have unlocked that output attributes to be available for editing)
  • For the attribute that you would like to change, for TYPE change from smallint/integer to text (width) or char(Based on the output format). SwitchDataType

 


Reply