web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Table relation issue in d365 bc cloud

(0) ShareShare
ReportReport
Posted on by 339

Hello all,

Please see below screenshot i am trying to add table relation In the batch name field  for form ( CutBack Batch)but in the Vs code table relation is not come

Please advise me how to to do this ?CutBack Batch form already published but in table relation is not come in VS code for CutBack Process form

tablerelationisnotcome.PNG

cutbackprocess.PNG

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    You need to set a Table relation when a field on table A is related to a field on table B.

    In your scenario, Batch Name field is related to what table X and on what unique field on this table X? If you know these two details, your table relation is done :)

  • SABIH Profile Picture
    339 on at

    Hello Stefano Demiliani ,

    "You need to set a Table relation when a field on table A is related to a field on table B."   here A is CutBackProcessTable  B is CutBackBatchTable

    Batch name field is in (CutBackProcessTable ) it is related table is CutBackBatchTable ,i want to add table relation in CutBackProcessTable .

    but when am trying to add table relation inside Batch name field relation is not come ,please see below screenshot

    cutbkrelation.PNG

    could you please check my below tables code correct or not and please help also table relation i want to add table relation ,could you please share Vs code also for this

    Please see below my CutBackProcessTable

    table 50106 CutBackProcessTable
    {
    DataClassification = ToBeClassified;

    fields
    {

    field(1; "Posting Date"; DateTime)
    {
    Caption = 'Posting Date';
    DataClassification = ToBeClassified;

    }
    field(2; "Account Category"; Code[20])
    {
    Caption = 'Account Category';
    DataClassification = ToBeClassified;
    TableRelation = "G/L Account Category";

    }
    field(3; "Bill Code"; Code[20])
    {
    Caption = 'Bill Code';
    DataClassification = ToBeClassified;
    TableRelation = "Dimension Value".Code;
    }

    field(4; "Partner"; Text[250])
    {
    Caption = 'Partner';
    DataClassification = ToBeClassified;
    }
    field(5; "License"; Text[200])
    {
    Caption = 'License';
    DataClassification = ToBeClassified;
    }
    field(6; "Percentage"; Option)
    {
    Caption = 'Percentage';
    OptionMembers = " ","Working Interest","Paying Interest","Revenue – Cost Oil","Revenue – Profit Oil";
    }
    field(7; "Account"; Text[20])
    {
    Caption = 'Account';
    DataClassification = ToBeClassified;

    }
    field(8; "Account Description"; Text[200])
    {
    Caption = 'Account Description';
    DataClassification = ToBeClassified;

    }
    field(9; "AFE"; Text[200])
    {
    Caption = 'AFE';
    DataClassification = ToBeClassified;

    }
    field(10; "Amount"; Integer)
    {
    Caption = 'Amount';
    DataClassification = ToBeClassified;

    }
    field(11; "Batch Name"; Text[250])
    {

    Caption = 'Batch Name';
    DataClassification = CustomerContent;


    TableRelation ="CutBack Batch" ?

    }
    field(12; "Posted"; Boolean)
    {
    width = 10;

    DataClassification = ToBeClassified;

    }
    }
    keys
    {
    key(PK; "Bill code")
    {
    //Clustered = true;
    }
    }

    }

    Please see below my CutBackBatchTable

    table 50107 CutBackBatchTable
    {
    DataClassification = ToBeClassified;

    fields
    {
    field(1; "Name"; Text[250])
    {
    Caption = 'Name';
    DataClassification = ToBeClassified;
    }
    field(2; "Description"; Code[20])
    {

    Caption = 'Description';
    DataClassification = ToBeClassified;
    }
    field(3; "Bill Code"; Code[20])
    {
    Caption = 'Bill Code';
    DataClassification = ToBeClassified;
    TableRelation = "Dimension Value".Code;
    }
    field(4; "Bill Code Description"; Text[250])
    {

    Caption = 'Bill Code Description';
    DataClassification = ToBeClassified;
    }
    field(5; "License"; Code[20])
    {

    Caption = 'License';
    DataClassification = ToBeClassified;
    }
    field(7; "License Description"; Text[250])
    {

    Caption = 'License Description';
    DataClassification = ToBeClassified;
    }
    }
    keys
    {
    key(PK; "Bill code")
    {
    //Clustered = true;
    }
    }

    }
  • SABIH Profile Picture
    339 on at

    Hello stefano Demiliani ,

    still am not getting table relation

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Your second table is very malformed, but this is another story :)

    Your table relation in the "Batch Name" field should be TableRelation = CutBackbatchTable.Name

  • SABIH Profile Picture
    339 on at

    Hi Stefano Demiliani ,

    actually relation is not come (CutBackbatchTable.Name  ) on the respective field (Batch Name)

    Please check the below table

    table 50106 CutBackProcessTable

    {

       DataClassification = ToBeClassified;

       fields

       {

           field(1; "Batch Name"; code[50])

           {

               Caption = 'Batch Name';

               DataClassification = CustomerContent;

           }

           field(2; "Bill Code"; Code[20])

           {

               Caption = 'Bill Code';

               DataClassification = ToBeClassified;

               TableRelation = "Dimension Value".Code;

           }

           field(3; "Account Category"; Code[20])

           {

               Caption = 'Account Category';

               DataClassification = ToBeClassified;

               //TableRelation = "G/L Account Category";

           }

           field(4; "Posting Date"; DateTime)

           {

               Caption = 'Posting Date';

               DataClassification = ToBeClassified;

           }

           field(5; "Partner"; Text[250])

           {

               Caption = 'Partner';

               DataClassification = ToBeClassified;

           }

           field(6; "License"; Text[200])

           {

               Caption = 'License';

               DataClassification = ToBeClassified;

           }

           field(7; "Percentage"; Option)

           {

               Caption = 'Percentage';

               OptionMembers = " ","Working Interest","Paying Interest","Revenue – Cost Oil","Revenue – Profit Oil";

           }

           field(8; "Account"; Text[20])

           {

               Caption = 'Account';

               DataClassification = ToBeClassified;

           }

           field(9; "Account Description"; Text[200])

           {

               Caption = 'Account Description';

               DataClassification = ToBeClassified;

           }

           field(10; "AFE"; Text[200])

           {

               Caption = 'AFE';

               DataClassification = ToBeClassified;

           }

           field(11; "Amount"; code[20])

           {

               Caption = 'Amount';

               DataClassification = ToBeClassified;

           }

           field(12; "Posted"; Boolean)

           {

               width = 10;

               DataClassification = ToBeClassified;

           }

       }

       keys

       {

           key(PK; "Batch Name", "Bill Code")

           {

               //Clustered = true;

           }

       }

    }

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    Set the TableRelation property on the field that must be related, so "Batch Name" in table 50106.

    So:

    field(1; "Batch Name"; code[50])

          {

              Caption = 'Batch Name';

              DataClassification = CustomerContent;

              TableRelation = CutBackbatchTable.Name   //If Name is the name to correlate, otherwise select the right field you need.

          }

  • SABIH Profile Picture
    339 on at

    Hello Stefano Demiliani

    Could you Please share me vs code for both table(CutBackProcessTable ,CutBackBatchTable )tables you can see above screenshot accordingly i can understand otherwise i will be confuse

  • Verified answer
    Ajay Kumar Jangiti Profile Picture
    130 on at

    Hi

    Please check the table relation for the table

    table 50106 CutBackProcessTable

    {

       DataClassification = ToBeClassified;

       fields

       {

           field(1; "Posting Date"; DateTime)

           {

               Caption = 'Posting Date';

               DataClassification = ToBeClassified;

           }

           field(2; "Account Category"; Code[20])

           {

               Caption = 'Account Category';

               DataClassification = ToBeClassified;

               TableRelation = "G/L Account Category";

           }

           field(3; "Bill Code"; Code[20])

           {

               Caption = 'Bill Code';

               DataClassification = ToBeClassified;

               TableRelation = "Dimension Value".Code;

           }

           field(4; "Partner"; Text[250])

           {

               Caption = 'Partner';

               DataClassification = ToBeClassified;

           }

           field(5; "License"; Text[200])

              {

               Caption = 'License';

               DataClassification = ToBeClassified;

           }

           field(6; "Percentage"; Option)

           {

               Caption = 'Percentage';

               OptionMembers = " ","Working Interest","Paying Interest","Revenue – Cost Oil","Revenue – Profit Oil";

           }

           field(7; "Account"; Text[20])

           {

               Caption = 'Account';

               DataClassification = ToBeClassified;

           }

           field(8; "Account Description"; Text[200])

           {

               Caption = 'Account Description';

               DataClassification = ToBeClassified;

           }

           field(9; "AFE"; Text[200])

           {

               Caption = 'AFE';

               DataClassification = ToBeClassified;

           }

           field(10; "Amount"; Integer)

           {

               Caption = 'Amount';

               DataClassification = ToBeClassified;

           }

           field(11; "Batch Name"; Text[250])

           {

               Caption = 'Batch Name';

               DataClassification = CustomerContent;

               TableRelation = CutBackBatchTable.Name;

           }

           field(12; "Posted"; Boolean)

           {

               width = 10;

               DataClassification = ToBeClassified;

           }

       }

       keys

       {

           key(PK; "Bill code")

           {

           }

       }

    }

  • SABIH Profile Picture
    339 on at

    Dear ajay ,

    Still am not getting table relation on respective field please find below my both table can you check there is have any issue

    CutBackProcessTable

    ***********************

    table 50106 CutBackProcessTable

    {

       DataClassification = ToBeClassified;

       fields

       {

           field(1; "Posting Date"; DateTime)

           {

               Caption = 'Posting Date';

               DataClassification = ToBeClassified;

           }

           field(2; "Account Category"; Code[20])

           {

               Caption = 'Account Category';

               DataClassification = ToBeClassified;

               TableRelation = "G/L Account Category";

           }

           field(3; "Bill Code"; Code[20])

           {

               Caption = 'Bill Code';

               DataClassification = ToBeClassified;

               TableRelation = "Dimension Value".Code;

           }

           field(4; "Partner"; Text[250])

           {

               Caption = 'Partner';

               DataClassification = ToBeClassified;

           }

           field(5; "License"; Text[200])

           {

               Caption = 'License';

               DataClassification = ToBeClassified;

           }

           field(6; "Percentage"; Option)

           {

               Caption = 'Percentage';

               OptionMembers = " ","Working Interest","Paying Interest","Revenue – Cost Oil","Revenue – Profit Oil";

           }

           field(7; "Account"; Text[20])

           {

               Caption = 'Account';

               DataClassification = ToBeClassified;

           }

           field(8; "Account Description"; Text[200])

           {

               Caption = 'Account Description';

               DataClassification = ToBeClassified;

           }

           field(9; "AFE"; Text[200])

           {

               Caption = 'AFE';

               DataClassification = ToBeClassified;

           }

           field(10; "Amount"; Integer)

           {

               Caption = 'Amount';

               DataClassification = ToBeClassified;

           }

           field(11; "Batch Name"; Text[250])

           {

               Caption = 'Batch Name';

               DataClassification = CustomerContent;

               TableRelation = CutBackBatchTable.Name" ;

           }

           field(12; "Posted"; Boolean)

           {

               width = 10;

               DataClassification = ToBeClassified;

           }

       }

       keys

       {

           key(PK; "Bill code")

           {

           }

       }

    }

    CutBackBatchTable

    ***********************

    table 50107 CutBackBatchTable

    {

       caption = 'CutBackBatchTable';

       DataClassification = ToBeClassified;

       fields

       {

           field(1; "Bill Code"; Code[20])

           {

               Caption = 'Bill Code';

               DataClassification = ToBeClassified;

               TableRelation = "Dimension Value".Code;

           }

           field(2; "Name"; Text[250])

           {

               Caption = 'Name';

               DataClassification = ToBeClassified;

           }

           field(3; "Description"; Text[250])

           {

               Caption = 'Description';

               DataClassification = ToBeClassified;

           }

           field(4; "Bill Code Description"; Text[250])

           {

               Caption = 'Bill Code Description';

               DataClassification = ToBeClassified;

           }

           field(5; "License"; Code[20])

           {

               Caption = 'License';

               DataClassification = ToBeClassified;

           }

           field(6; "License Description"; Text[250])

           {

               Caption = 'License Description';

               DataClassification = ToBeClassified;

           }

       }

       keys

       {

           key(PK; "Bill Code")

           {

               //Clustered = true;

           }

       }

    }

  • SABIH Profile Picture
    339 on at

    tblrela.PNG

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.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans