Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 22
Registered: ‎04-04-2016
Accepted Solution

Creating AutoNumber field in GeoPackage warehouse

Hi all,

I am trying to create a new table in a GeoPackage warehouse and I want to have a field called ID to be the primary key and an AutoNumber.
To do so I am creating a GField of Type gdbLong and I am setting its Attributes property to the value 16, which should mean that it is automatically incremented. So, when adding data to the table I do not have to fill in this field.

This worked nicely for all databases I have been using up to now. But now with the new GeoMedia 16.5 version i tried to do the same for a GeoPackage Warehouse, but here my Attributes property seems to be ignored.
The ID field gets type Long but is not automatically incremented, which leads to an error when I try to add data without filling in the ID field.

Does anyone have an idea about this problem? I appreciate any help!

Thanks and regards
Cecilia

Technical Evangelist
Technical Evangelist
Posts: 218
Registered: ‎02-03-2016

Re: Creating AutoNumber field in GeoPackage warehouse

Keys and autonumbers are a challenge for us with GeoPackage due to the fact that GeoPackage requires a primary key that is a single autonumber field.  By default it is named FID, but it can be named something else.  GeoMedia attempts to hide this restrictive condition as best it can.  For example, you can have such a field named FID, such a field by any other name, or even pretend to have some other kind of key but with a FID "actual" primary key autonumber behind the scenes (GeoMedia still treats your designated primary key properly as one, but SQLite won't know about its key status).

 

Probably you are running into some situation in which we are contending with this circumstance.  The order in which things are done could matter, for example.  Please send your code snippet that shows the sequence of creating the table and fields, and let us have a look.  If it's not obvious, we'll ask you to file a support ticket so that we can reproduce and debug.  - Hal

 

Contributor
Posts: 22
Registered: ‎04-04-2016

Re: Creating AutoNumber field in GeoPackage warehouse

Thank you very much for your prompt answer. I was able to solve my problem now as it indeed depended on the order in which I created the fields and the index.

It seems to be important to first create the index and then the AutoNumber field and not the other way around as I tried to do it.

Best
Cecilia

Technical Evangelist
Technical Evangelist
Posts: 218
Registered: ‎02-03-2016

Re: Creating AutoNumber field in GeoPackage warehouse

Thanks for that info.  We will look into it and perhaps file a bug.  I'm glad you're past the situation.  - Hal

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.