Select to view content in your preferred language

Problem QueryRelatedAsync -> Exception

3204
5
Jump to solution
10-13-2014 04:49 AM
MarkoKangas
Deactivated User

Hi,

I have two tables both are ObjecClass (no geometry).

  • TableA
    • OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID , editable: false , nullable: false )
    • GLOBALID ( type: esriFieldTypeGlobalID , alias: GLOBALID , editable: false , nullable: false , length: 38 )
    • CHANGER( type: esriFieldTypeString , alias: CHANGER, editable: true , nullable: false , length: 20 )
    • CHANGEDATE ( type: esriFieldTypeDate , alias: CHANGEDATE , editable: true , nullable: false , length: 36 )
    • CREATOR ( type: esriFieldTypeString , alias: CREATOR , editable: true , nullable: false , length: 20 )
    • CREATED ( type: esriFieldTypeDate , alias: CREATED , editable: true , nullable: false , length: 36 )
  • TableB
    • OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID , editable: false , nullable: false )
    • AREANUMBER( type: esriFieldTypeInteger , alias: AREANUMBER, editable: true , nullable: false )
    • ARCHIVE ( type: esriFieldTypeInteger , alias: ARCHIVE, editable: true , nullable: false )
    • GLOBALID ( type: esriFieldTypeGlobalID , alias: GLOBALID , editable: false , nullable: false , length: 38 )
    • TABLEA_GLOBALID ( type: esriFieldTypeGUID , alias: MKI_GLOBALID , editable: true , nullable: true , length: 38 )
    • CHANGER( type: esriFieldTypeString , alias: CHANGER, editable: true , nullable: false , length: 20 )
    • CHANGEDATE ( type: esriFieldTypeDate , alias: CHANGEDATE , editable: true , nullable: false , length: 36 )
    • CREATOR ( type: esriFieldTypeString , alias: CREATOR , editable: true , nullable: false , length: 20 )
    • CREATED ( type: esriFieldTypeDate , alias: CREATED , editable: true , nullable: false , length: 36 )

- TableA has relationship to TableB 1..n (BelongsTo (13) -- Related To: TableB (16))

If I try after opening and querying TableA to (ServiceFeatureTabke) QueryRelated from TableB I Get exception ({"Specified argument
was out of the range of valid values.\r\nParameter name: length"}
) :

*    at Esri.ArcGISRuntime.Data.FieldInfo..ctor(String name, String alias, FieldType type, Nullable`1 length, Boolean editable, Boolean nullable, Domain domain)

   at Esri.ArcGISRuntime.Tasks.Query.RelationshipResult.GetFieldsFromJsonDictionary(JsonDictionary jsonDictionary)

   at Esri.ArcGISRuntime.Tasks.Query.RelationshipResult.FromJsonDictionary(JsonDictionary jsonDictionary, String tableName)

   at Esri.ArcGISRuntime.Tasks.Query.QueryTask.<ExecuteRelationshipQueryInternal>d__2c.MoveNext()

I have tried change  Thread currentculture to en-US no effect. Using 10.2.4 SDK.

Any clue ? workaround?

0 Kudos
1 Solution

Accepted Solutions
GregDeStigter
Esri Contributor

This looks like an issue we've seen with GUID fields in related tables that is slated to be fixed in the next version. I'm curious, if you perform your query using a QueryTask and filter out the 'TABLEA_GLOBALID' field if it will return successfully.  Please try the following type of query with your data:

var relParam = new RelationshipParameters(new long[] { 1L }, 0L);

relParam.OutFields = new OutFields(new string[] { "AREANUMBER", "ARCHIVE", "GLOBALID" });

var queryTask = new QueryTask(new Uri(FeatureServiceUrl));

var result = await queryTask.ExecuteRelationshipQueryAsync(relParam);

-Greg

View solution in original post

0 Kudos
5 Replies
JenniferNery
Esri Regular Contributor

Are you working with ServiceFeatureTable? Would it be possible for you to share also the JSON response from the QueryRelatedAsync call? I believe this exception has something to do with parsing the Fields in the JSON and would happen only if Fields with type esriFieldTypeString is missing length property.

Thanks.

Jennifer

0 Kudos
PreetiMaske
Esri Regular Contributor

Hi,

I am unable to repro the problem you are seeing with Querying related rows between two tables. Would it be possible for you to share your data ?

0 Kudos
MarkoKangas
Deactivated User

Its working directly from Esri ArcGIS server service query site (Fiddler -> RAW)

If problem isn't those fields. I added all TableB fields to repro. Problem is related those added fields -> (AREANUMBER, ARCHIVE, GLOBALID, TABLEA_GLOBALID).

Here is JSON response (added all fields):

{

"fields": [

  {

   "name": "OBJECTID",

   "alias": "OBJECTID",

   "type": "esriFieldTypeOID"

  },

  {

   "name": "AREANUMBER",

   "alias": "AREANUMBER",

   "type": "esriFieldTypeInteger"

  },

  {

   "name": "ARCHIVE",

   "alias": "ARCHIVE",

   "type": "esriFieldTypeInteger"

  },

  {

   "name": "GLOBALID",

   "alias": "GLOBALID",

   "type": "esriFieldTypeGlobalID",

   "length": 38

  },

  {

   "name": "TABLEA_GLOBALID",

   "alias": "TABLEA_GLOBALID",

   "type": "esriFieldTypeGUID",

   "length": 38

  },

  {

   "name": "CREATOR",

   "alias": "Creator",

   "type": "esriFieldTypeString",

   "length": 20

  },

  {

   "name": "CREATED",

   "alias": "Created",

   "type": "esriFieldTypeDate",

   "length": 36

  },

  {

   "name": "CHANGER",

   "alias": "Changer",

   "type": "esriFieldTypeString",

   "length": 20

  },

  {

   "name": "CHANGEDATE",

   "alias": "Changedate",

   "type": "esriFieldTypeDate",

   "length": 36

  }

],

"relatedRecordGroups": [

  {

   "objectId": 2262,

   "relatedRecords": [

    {

     "attributes": {

      "OBJECTID": 2999,

      "AREANUMBER": 1,

      "ARCHIVE": 0,

      "GLOBALID": "{9830E5CE-3D79-4606-9B50-4912E3072EF2}",

      "TABLEA_GLOBALID": "{EFCE8592-7D91-4DD4-93D8-8CEDCE661427}",

      "CREATOR": "UnitTest",

      "CREATED": 1412695974000,

      "CHANGER": "UnitTest",

      "CHANGEDATE": 1412695974000

     }

    },

    {

     "attributes": {

      "OBJECTID": 3000,

      "AREANUMBER": 2,

      "ARCHIVE": 0,

      "GLOBALID": "{17C7D5EE-09BD-4F3D-AE08-51C47E1C885E}",

      "TABLEA_GLOBALID": "{EFCE8592-7D91-4DD4-93D8-8CEDCE661427}",

      "CREATOR": "UnitTest",

      "CREATED": 1412695974000,

      "CHANGER": "UnitTest",

      "CHANGEDATE": 1412695974000

     }

    }

   ]

  }

]

}

0 Kudos
GregDeStigter
Esri Contributor

This looks like an issue we've seen with GUID fields in related tables that is slated to be fixed in the next version. I'm curious, if you perform your query using a QueryTask and filter out the 'TABLEA_GLOBALID' field if it will return successfully.  Please try the following type of query with your data:

var relParam = new RelationshipParameters(new long[] { 1L }, 0L);

relParam.OutFields = new OutFields(new string[] { "AREANUMBER", "ARCHIVE", "GLOBALID" });

var queryTask = new QueryTask(new Uri(FeatureServiceUrl));

var result = await queryTask.ExecuteRelationshipQueryAsync(relParam);

-Greg

0 Kudos
MarkoKangas
Deactivated User

Tried and that works so problem is those esriFieldTypeGUID fields.

Need to make workaround and wait bug fix...

Thanks Greg

0 Kudos