TableRelation field length (PC0028)

When defining a TableRelation, the field lengths should be compatible. A relation from a longer field to a shorter one, or vice versa, may cause data integrity issues or runtime errors.

Example

The following code has mismatched field lengths:

table 50100 MyTable
{
    fields
    {
        field(1; CustomerNo; Code[30]) // TableRelation field length [PC0028]
        {
            TableRelation = Customer."No."; // Customer.No is Code[20]
        }
    }
}

To fix this, ensure field lengths match:

table 50100 MyTable
{
    fields
    {
        field(1; CustomerNo; Code[20])
        {
            TableRelation = Customer."No.";
        }
    }
}