AnsweredAssumed Answered

Queries using GUID fields - strange behavior

Question asked by mikedmanak on Dec 22, 2015
Latest reply on Feb 5, 2016 by DGoyal-esristaff

We are using GUID fields in one of our new apps to store primary/secondary keys.  In the past we've used GUID/UUID but stored them in plain old text fields.

 

When querying this data in the ArcGIS Runtime using an AGSQuery object we are running into some strange behavior.

 

If we select a GUID field out as an NSString or NSUUID object it returns something like this:

9f6d8cac-19b4-4e24-af96-4654aac8287e

 

Note that this is not quite the same as GUIDs when viewed in ArcGIS - they don't have the curly brackets {}.  The strange thing is that if I then try to use this value in a query, say to get all records for a feature with this primary key, I have to manually add the brackets back in like so:

    query.whereClause = [NSString stringWithFormat:@"SurveyID = '{%@}'",[self.surveyID uppercaseString]];

 

Note that in addition to manually adding the curly brackets back in, I've also had to convert the string to upper case.  If I don't do this I have to use the LIKE operator instead of =.

 

Any idea why GUID fields are behaving so strangely?  I'm worried that records I create in the mobile app using a new UUID (iOS version of GUID) won't check in correctly, or the value will be altered when checked in.

 

Any ideas why the query behavior of this data type is so inconsistent?

Outcomes