lvargasgeotecnologias-esridist

GeoEvent Definition with an Array of Different Value Type

Discussion created by lvargasgeotecnologias-esridist Employee on Sep 2, 2019

Hello,

 

I had this “issue” a few days ago, and I'd like to share the workflow.

 

Scenery:

The input it’s a JSON, was obtained through a REST and looks like this. The first value in the array it’s a Double, the second and third are a Boolean (is important that the types of values in the array are different).

 

 

 

The Output it’s a Feature Service running in ArcGIS Server (10.7.1).

 

Fields:

objectid ( type: esriFieldTypeOID, alias: OBJECTID, nullable: false, editable: false )

username ( type: esriFieldTypeString, alias: username, editable: true, nullable: true, length: 25 )

userid ( type: esriFieldTypeDouble, alias: userID, editable: true, nullable: true )

lng ( type: esriFieldTypeDouble, alias: lng, editable: true, nullable: true )

lat ( type: esriFieldTypeDouble, alias: lat, editable: true, nullable: true )

alt ( type: esriFieldTypeDouble, alias: alt, editable: true, nullable: true )

speed ( type: esriFieldTypeDouble, alias: speed, editable: true, nullable: true )

heading ( type: esriFieldTypeDouble, alias: heading, editable: true, nullable: true )

lastseen ( type: esriFieldTypeString, alias: lastSeen, editable: true, nullable: true, length: 25 )

sos ( type: esriFieldTypeString, alias: sos, editable: true, nullable: true, length: 10 )

low_battery ( type: esriFieldTypeString, alias: Low_Battery, editable: true, nullable: true, length: 10 )

 

The values that interest me most are those found within the arrangement called Speed (it’s just a random value, the idea is that the first value is a Double), SOS and Low Battery (these are Boolean type).

 

{

    "id": -1,

    "result": [

        {

            "records": [

                {

                    "fieldName": "Speed",

                    "fieldID": 33,

                    "value": 3.0558000006926482,

                    "valueType": "System.Double"

                },

                {

                    "fieldName": "SOS",

                    "fieldID": 20,

                    "value": true,

                    "valueType": "System.Boolean"

                },

                {

                    "fieldName": "Low Battery",

                    "fieldID": 24,

                    "value": true,

                    "valueType": "System.Boolean"

                }

            ],

 

The “Issue

GeoEvent automatically takes the first value of the array as the default value for all the definition values in the array, in this case the first value it’s a double.

 

{

    "id": -1,

    "result": [

        {

            "records": [

                {

                    "fieldName": "Speed",

                    "fieldID": 33,

                    "value": 3.0558000006926482,

                    "valueType": "System.Double"

                },

 

 

So, this cause that the other values (Boolean) was not identified correctly. Then this makes the remaining values (Boolean) can’t be "read" and have a null value in the service. If in the definition we defines Boolean instead of Double as the default value type, the double values does not work. 

 

The alternative:

Is making a change in the definition and define the values as String.

 

 

Once this change has been made, the updates to the service are done correctly.

 

 

The Field Mapper looks like this.

 

 

This the result:

 

objectid: 10

username: TrackerOne1

userid: 14.0

lng: -84.05072

lat: 9.93914

alt: 14.0

speed: 3.8892

heading: 14.0

lastseen: Mon Aug 26 10:24:06 CST 2019

sos: false

low_battery: true

Point:

X: -9356483.351208016

Y: 1112011.1996998154

 

Regards.

Outcomes