AL icon indicating copy to clipboard operation
AL copied to clipboard

Changing TableRelation has no impact

Open sweikelt opened this issue 6 years ago • 5 comments

Modifiying the TableRelation in a existing table has no impact on the TableRelation - the original (old) relation will continied to be used.

Sample Code:

tableextension 85005 CustExt extends Customer
{
    fields
    {
        modify("Location Code")
        {
            TableRelation = "Post Code";
        }
    }

}

2020-01-06 14_25_07-Window

AL Language: 3.0.150570 (tested it with 4.0.209944, too) BC: 14.0.34251.0

Maybe i'm doing something wrong.

sweikelt avatar Jan 06 '20 13:01 sweikelt

Hi! In the docs https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-tablerelation-property it specifies that the extension is only extended and not overwritten. That behavior is in line with what you are reporting. Does it make sense?

atoader avatar Jan 07 '20 05:01 atoader

Hi atoader, sure makes sense - i've choosen this easy example because i tried to modify an existing tableRelation with a filter, but the filter didn't work. the documentation said, that it would work or do i interprete the doc wrong.

so i'll give a another try an report it here

sweikelt avatar Jan 07 '20 07:01 sweikelt

Thanks! I want to underline that the original filter will be applied and the filter you add. Please also test it on the latest release. As stated in our FAQ, on GitHub, we can only accept issues on the latest release, issues on other releases must go through the standard support channels.

atoader avatar Jan 07 '20 07:01 atoader

This issue has been closed because it needs more information and has not had recent activity. Please open a new issue if you believe this has not been resolved and reference the current issue.

atoader avatar Apr 02 '20 09:04 atoader

Hi @atoader, this issue seems has not been resolved in BC v19

I need to do this TableRelation change in my project, but it doesn't work and it still appliying the original standard TableRelation, even though it compiles:

tableextension 50000 "BOM Component Ext" extends "BOM Component"
{
    fields
    {
        modify("Parent Item No.")
        {
            // Add "Non-Inventory" Items for having BOM Components
            // It doen't work at BC v19!
            TableRelation = Item."No." where(Type = filter(Inventory | "Non-Inventory"));
        }
    }
}

QUESTION.- In BC standard, a "Non-Inventory" Item can be part of a "BOM Component" of a Parent-Item, BUT, why can't has its own "BOM Component" list

table 90 "BOM Component"
{
    Caption = 'BOM Component';
    DrillDownPageID = "Assembly BOM";
    LookupPageID = "Assembly BOM";

    fields
    {
        field(1; "Parent Item No."; Code[20])
        {
            Caption = 'Parent Item No.';
            NotBlank = true;
            TableRelation = Item WHERE(Type = CONST(Inventory));
        }

        field(2; "Line No."; Integer) { ... }

        field(3; Type; Enum "BOM Component Type") { ... }

        field(4; "No."; Code[20])
        {
            Caption = 'No.';
            TableRelation = 
            IF (Type = CONST(Item)) Item WHERE(Type = FILTER(Inventory | "Non-Inventory"))
            ELSE
            IF (Type = CONST(Resource)) Resource;

            [ ... ]
        }

        [ ... ]
    }

    [ ... ]
}

BC Version: ES Business Central 19.1 (Plataforma 19.0.31889.34054 + Aplicación 19.1.31886.34210)

AL Language VSCode extension: v8.3.570094

JavierFuentes avatar Jan 31 '22 11:01 JavierFuentes