Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating new keys in a tableextension with fields form the original table #1054

Closed
BertDeTemmerman opened this issue Dec 6, 2017 · 3 comments

Comments

@BertDeTemmerman
Copy link

I have a tableextension on customer table that contains extra keys:

keys
  {
        key(Key1;"Customer Price Group")
        {
        }
        key(Key2;"Statistics Group")
        {
        }
        key(Key3;"Commission Group")
        {
        }
    }

The field at Key1 and Key2 are of NAV, the field in Key3 is one from my application.
The Key1 and Key2 has the problem: [AL] A field list has to contain at least one field.
The "Customer Price Group" and "Statistics Group" have the problem:

[AL] Reference '"Customer Price Group"' in application object 'tableextension50101' does not exist
[AL] The keys 'Key1' and 'Key2' have an identical list of fields.

Another object is a tableextension on Sales Header with the following extra keys:

keys
    {
        key(Key1;"Document Type","Combine Shipments","Bill-to Customer No.","Currency Code","EU 3-Party Trade","Dimension Set ID","Journal Template Name","Ship-to Code","Invoicing System")
        {
        }
        key(Key2;"Bill-to Customer No.")
        {
        }
}

These are all NAV fields, but these don't have any problems ...

What is missing on the keys for the customer tableextension?

@HunterFeltman-MSFT
Copy link

Unfortunately, table extensions do not currently support 'cross-keys' from fields that are not part of the extension with the exception of the primary key.
This means that you cannot reference non-PK fields from the 'base' table inside of a key list.

The errors you are seeing in your first example are a result of this:

  1. The compiler doesn't recognize the fields from the base as existing/available in this context
  2. Since the fields are recognized, the compiler sees an 'empty' key list
  3. Since both Key1 & Key2 have 'empty' key lists, they are seen as duplicates

Your second example should also produce the same errors. My guess is that there is an error above or elsewhere in the file that is in some way causing the compiler to stop parsing that file and thus not reach these keys yet.

If you were to create a new, completely empty table extension for the "Sales Header" table, and add these keys to it, I would expect to see the same/similar errors as your first example

@BertDeTemmerman
Copy link
Author

Unfortunately, table extensions do not currently support 'cross-keys' from fields that are not part of the extension with the exception of the primary key.
This means that you cannot reference non-PK fields from the 'base' table inside of a key list.

Please make this possible!!
I can see the logic and reason behind this.
However if can't create new keys on NAV-fields, we will have a huge performance loss.

I would be very suprised if there would be any application of ISV's that doesn't have an extra key on NAV-fields (combined with fields from the application).

Perhaps make it also possible to add extra SIF to existing NAV-keys?

@StanislawStempin
Copy link

This is a duplicate of #730. Let's continue the thread in one place.

@microsoft microsoft locked and limited conversation to collaborators Apr 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants