03-22-2018 06:31 AM
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
Solved! Go to Solution.
03-22-2018 06:58 AM
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
03-23-2018 02:28 AM
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.