AnsweredAssumed Answered

Save feature with GUID field to local SQLite geodatabase

Question asked by jmburns on Mar 31, 2014
Latest reply on Apr 15, 2014 by DGoyal-esristaff
Hi,

I am using the 10.2.2 version of the SDK and working with the offline editing capabilities.  The particular layer I am working with has a GUID type field in addition to the GlobalID field.  When I try to save a new AGSGDBFeature to the AGSGDBFeatureTable the app crashes.  I have been able to successfully save to that layer without supplying a value for the GUID field.  SQLite does not have a GUID datatype.  When Server for ArcGIS generates the geodatabase it represents GUID field types as uuidtext custom type in SQLite.  The name suggests that this is a text type field.  If I open the geodatabase in SQLite Manager (Firefox add-in) I can successfully paste a GUID string into the edit dialog for a row and save.  This tells me that it is not a SQLite error.  I'm wondering if anyone else has tried this yet and if this may be a bug in the SDK.

    AGSGDBFeatureTable* fbFeatTable = [self.geodatabase featureTableForLayerID:1];     if (fbFeatTable.canCreate && fbFeatTable.canUpdate)     {         AGSGDBFeature* feature = [[AGSGDBFeature alloc] initWithTable:fbFeatTable];          // I've tried these variations         //[feature setAttribute:[NSUUID UUID] forKey:@"RecGuid"];         //[feature setAttribute:[[NSUUID UUID] UUIDString] forKey:@"RecGuid"];         //[feature setAttribute:[NSString stringWithFormat:@"{%@}", [[NSUUID UUID] UUIDString]] forKey:@"RecGuid"];         [feature setAttributeWithString:[NSString stringWithFormat:@"{%@}", [[NSUUID UUID] UUIDString]] forKey:@"RecGuid"];          [feature setAttributeWithString:@"Test1" forKey:@"aaa"];         [feature setGeometry:geometry];                  NSError* saveError;         if ([fbFeatTable saveFeature:feature error:&saveError])          {             NSLog(@"Saved.");         }         else         {             NSLog(@"Error Saving: %@", saveError);         }     }     else     {         NSLog(@"%@ does not allow new features.", fbFeatTable.tableName);     }


Thanks,
Justin

Outcomes