Question

Write GUID to ArcSDE Enterprise Geodatabase

  • 6 November 2013
  • 5 replies
  • 2 views

Badge +21
I am generating new features in a workspace and wants to write to 2 already defines features in ArcSDE:

 

 

Feature1:

 

fme_feature_type: Road

 

geodb_oid: 1

 

 

Feature2:

 

fme_feature_type: RoadFeature

 

geodb_oid: 2

 

MY_FOREIGN_KEY (guid): 1

 

 

The issue is that I only get an error when I try to insert Feature 2 in another table: |An error occurred while attempting to insert a value into the field 'MY_FOREIGN_KEY' for the table 'RoadFeature'. The error number from ArcObjects is: '-2147219887'. The error message from ArcObjects is: {}.

 

 

I suspect i need the UUID from Feature1 to insert as the MY_FOREIGN_KEY in Feature2? However how can I do this when I am writing both features at the same time? I have other tables with M:M connections and a temporary geodb_oid on each object and a table describing the relationship and these goes through smoothly with correct connections in ArcSDE.

 

 

Any suggestions what to try to be able to write to an attribute of type GUID in ArcSDE Enterprise?

 


5 replies

Hi Sig,

 

 

You can't write an integer-value into a field of type GUID.

 

You have to create an UUID for Feature1 with the GUIDGenerator. Then you write this UUID into the primary key of featuer1 and to the MY_FOREIGN_KEY of Feature2.

 

 

Thomas
Userlevel 4
Hi,

 

 

Thomas is right. Take notice, however, that the GUID must be on the form

 

{4FE4EA2D-3859-4C11-B129-18C047E82F58}

 

This means that you have to care care and include the start and end brackets. You can use this formula in an e.g. an AttributeCreator:

 

{@UUID()}

 

David
Badge +21
Sorry, my bad. I was already using the proper GUID value. However the challenge is that both features are NEW and created within the workspace.
Badge +21
So the geodb_oid of fme_feature_type: Road is NOT already in the database but gets created in the workspace. So you do not know the MY_FOREIGN_KEY (GUID) of fme_feature_type: RoadFeature. 
Badge +21
So the MY_FOREIGN_KEY does not exist in Feature1 when starting the workspace. It gets created within the workspace. I am trying to now first instert the fme_feature_type: Road in one workspace - and then read the fme_feature_type: Road in a second workspace to get the OBJECTID to attach. However doing this in only 1 workspace is ofcourse the best solution. Anyone from SAFE care to comment?

Reply