<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can't seem to get booleans out of JSON and into database in ArcGIS GeoEvent Server Questions</title>
    <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/can-t-seem-to-get-booleans-out-of-json-and-into/m-p/1008070#M3436</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm polling for JSON and inserting/updating a SQL Server backed feature class.&amp;nbsp; It's mostly working... I'm getting features into the database, but I just can't seem to handle the booleans&amp;nbsp; in the JSON correctly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is sample data from the feed at the bottom of this post... for example, the "has_kisosk" field is going to be true/false.&lt;/P&gt;&lt;P&gt;The input geoevent definition has that field as a bool, and if I write that event directly out to JSON, the value comes across fine. Getting it into the database is the problem.&amp;nbsp; My database schema is a bit different in terms of field names.&amp;nbsp; Also, booleans are stored as smallint or bit fields in SQL Server (I'm using smallint).&lt;/P&gt;&lt;P&gt;So, my output geoevent defintion has the boolean field as type "short"and&amp;nbsp;&lt;SPAN&gt;I use a field mapper to make that transformation from input to output geoevent defintion. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The problem is that all boolean fields come across as null from the output geoevent def.&amp;nbsp; This is consistent in the database as well as if I write this output geoevent defintion to JSON.&amp;nbsp; If I make the output geoevent defintion also use type "boolean" then I can see the values in my output JSON, but the feature service records the following in the ArcGIS server log:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: The value type is incompatible with the field type. [HAS_KIOSK].&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems like booleans aren't being automatically transformed into shorts (or other integer types).&amp;nbsp; Can anyone provide some pointers on how to handle this?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
	"data": {
		"stations": [{
			"lat": 45.51898132,
			"rack_model": "CITY_PILOT_RACK",
			"legacy_id": "1440914125193298376",
			"address": "Park Avenue West, Southwest Yamhill Street, Portland",
			"region_code": "PDX",
			"name": "SW Yamhill at Director Park",
			"eightd_station_services": [],
			"rental_uris": {
				"android": "https://pdx.lft.to/lastmile_qr_scan",
				"ios": "https://pdx.lft.to/lastmile_qr_scan"
			},
			"capacity": 20,
			"eightd_has_key_dispenser": false,
			"station_id": "1440914125193298376",
			"lon": -122.6812685,
			"station_type": "lightweight",
			"has_kiosk": false,
			"electric_bike_surcharge_waiver": false,
			"external_id": "motivate_PDX_1440914125193298376",
			"dockless_bikes_parking_zone_capacity": 20,
			"client_station_id": "motivate_PDX_1440914125193298376"
		}]
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 15:32:27 GMT</pubDate>
    <dc:creator>Mike_Quetel</dc:creator>
    <dc:date>2020-12-09T15:32:27Z</dc:date>
    <item>
      <title>Can't seem to get booleans out of JSON and into database</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/can-t-seem-to-get-booleans-out-of-json-and-into/m-p/1008070#M3436</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm polling for JSON and inserting/updating a SQL Server backed feature class.&amp;nbsp; It's mostly working... I'm getting features into the database, but I just can't seem to handle the booleans&amp;nbsp; in the JSON correctly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is sample data from the feed at the bottom of this post... for example, the "has_kisosk" field is going to be true/false.&lt;/P&gt;&lt;P&gt;The input geoevent definition has that field as a bool, and if I write that event directly out to JSON, the value comes across fine. Getting it into the database is the problem.&amp;nbsp; My database schema is a bit different in terms of field names.&amp;nbsp; Also, booleans are stored as smallint or bit fields in SQL Server (I'm using smallint).&lt;/P&gt;&lt;P&gt;So, my output geoevent defintion has the boolean field as type "short"and&amp;nbsp;&lt;SPAN&gt;I use a field mapper to make that transformation from input to output geoevent defintion. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The problem is that all boolean fields come across as null from the output geoevent def.&amp;nbsp; This is consistent in the database as well as if I write this output geoevent defintion to JSON.&amp;nbsp; If I make the output geoevent defintion also use type "boolean" then I can see the values in my output JSON, but the feature service records the following in the ArcGIS server log:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Error: The value type is incompatible with the field type. [HAS_KIOSK].&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems like booleans aren't being automatically transformed into shorts (or other integer types).&amp;nbsp; Can anyone provide some pointers on how to handle this?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
	"data": {
		"stations": [{
			"lat": 45.51898132,
			"rack_model": "CITY_PILOT_RACK",
			"legacy_id": "1440914125193298376",
			"address": "Park Avenue West, Southwest Yamhill Street, Portland",
			"region_code": "PDX",
			"name": "SW Yamhill at Director Park",
			"eightd_station_services": [],
			"rental_uris": {
				"android": "https://pdx.lft.to/lastmile_qr_scan",
				"ios": "https://pdx.lft.to/lastmile_qr_scan"
			},
			"capacity": 20,
			"eightd_has_key_dispenser": false,
			"station_id": "1440914125193298376",
			"lon": -122.6812685,
			"station_type": "lightweight",
			"has_kiosk": false,
			"electric_bike_surcharge_waiver": false,
			"external_id": "motivate_PDX_1440914125193298376",
			"dockless_bikes_parking_zone_capacity": 20,
			"client_station_id": "motivate_PDX_1440914125193298376"
		}]
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/can-t-seem-to-get-booleans-out-of-json-and-into/m-p/1008070#M3436</guid>
      <dc:creator>Mike_Quetel</dc:creator>
      <dc:date>2020-12-09T15:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can't seem to get booleans out of JSON and into database</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/can-t-seem-to-get-booleans-out-of-json-and-into/m-p/1053469#M3531</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/331798"&gt;@Mike_Quetel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Booleans should be handled as either String or a numeric number (depending on your feature service and how you set it up).&amp;nbsp; Import the GeoEvent Definition from the Feature Service you are writing to (delete the OBJECTID, GUID, and any other managed fields) then use a field mapper to map your events into that defintion before writing out to your feature service.&amp;nbsp; If your fields are numeric, you'll need to use a field calculator before the field mapper to convert boolean into numeric. for boolean fields, I recommend you use a string because you can map a boolean field to a string field directly in the Field Mapper.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 22:21:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/can-t-seem-to-get-booleans-out-of-json-and-into/m-p/1053469#M3531</guid>
      <dc:creator>EricIronside</dc:creator>
      <dc:date>2021-04-30T22:21:53Z</dc:date>
    </item>
  </channel>
</rss>

