Notifications
Announcements
No record found.
Hi guys,
I have a custom table that currently use as staging table and it is possible at some time most of the field (not all) are same, However I need to have index with eventually will be a primary index since I'm gonna need to create data entity of it. In my understanding, we should have primary index which obviously will need unique value.
May I know what is the solution of this? I am thinking of just use RecId as the field in my index, would it be fine ? or is there better approach ?
Thanks,
Is your intention to import data through this entity, or will it be a readonly entity used for export only?
Hi Martin,
It is for export only. I need to create that data entity because just found out it is mandatory so that I can have the feature "Open In Excel" when open from SysTableBrowser.
If it's just for export (you won't be able to pub;ish data from Excel), then having RecId as an entity key isn't a big deal.
Nevertheless I would still think about a natural key of the table.
Yes, I think I won't need to publish data. But out of curiosity does it mean by using RecId will make it unable to publish or is there anything else ?
May I know what about the natural key ? I'm sorry I just do not play around with tables key until recently, so might need further explanation of what I should consider.
Hi Lars,
Let's take a standard table as example to illustrate the issue for using record IDs as entity key for a data entity.
The customer groups table has a primary index on the field Customer group. It will not allow for duplicates. When you create a new record, it will generate a unique record ID as well. The record ID value itself does not have any meaning. It can be used for references in other tables.
When you create the same customer group in another environment, it will have another record ID.
Now when you import data using a data entity, it will try to find existing records based on the entity key. If this is the customer group, it can find a match and would update a record. If there is no existing record, it will create a new one. When the entity key is the record ID, it will not find the same record (as the record ID is different) and will try to create a second customer group with the same customer group ID.
Hi,
Yes, I'd just remembered about this natural key thing. There is "Natural key" error in Data Entity Wizard if we do not have Primary key with our own field, and it also doesn't accept if RecId is part of the index when create Data entity.
So is there a better approach how to have a primary index when most of the fields may have same value ?
HI Lars,
Above, you mentioned that the data entity will be used for export only. In this scenario, you don't have to worry about the entity key. There are several tables in the standard application having multiple fields to determine the primary key. In that scenario it is not an issue to list e.g. 5 fields as the entity key.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional