Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Table relation is not visible in sales - line

Posted on by 85

In our items table we have next to our no. column (No.) a second no. column (No. 2) with our old article numbers.

Now I need to display the No.2 entries in our sales reports.

I have created a table relation in the sales - line table (Table 37 Sales Line) and created a field in the sales - lines page (Page 516 Sales Lines).

Also I have added the field into the sales - quote report to check if it works, but neither the no.2 entries are displayed in the report nor I can add the no.2 column into the sales - quote form. 

The no.2 column is visible in the sales - line table, but it's empty.

How can I create a table relation from the items table to the sales - line table?

Bildschirmfoto-2019_2D00_04_2D00_04-um-09.07.53.png

Bildschirmfoto-2019_2D00_04_2D00_04-um-09.08.19.png

Bildschirmfoto-2019_2D00_04_2D00_04-um-09.08.51.png

*This post is locked for comments

  • Suggested answer
    Guillem Padilla Profile Picture
    Guillem Padilla 425 on at
    RE: Table relation is not visible in sales - line

    It seems a license problem, to be able to access the code of the table you have to change the license to one with permission to develop, maybe a partner license.

    Steps:

    Tools > License Information > Change

    And then select the correct developer license

  • Yupp90 Profile Picture
    Yupp90 85 on at
    RE: Table relation is not visible in sales - line

    Where do I have to add the code-snippet?

    I can't add it to the table, since C/AL Code is disabled for tables (or at least I can't open it).

  • Suggested answer
    Guillem Padilla Profile Picture
    Guillem Padilla 425 on at
    RE: Table relation is not visible in sales - line

    Hello,

    TableRelation does not fill the field value automatically, more information here: docs.microsoft.com/.../tablerelation-property

    I recommend you use the solution proposed by Hannes.

    If you want to set the value in older lines you should make a ProcessOnly (it is a property) report with Table 37 (Sales Line) as a DataItem, and assign "No. 2" in OnAfterGetRecord trigger, example:

    Sales Line - OnAfterGetRecord()
    
    IF Type = Type::Item THEN IF Item.GET("No.") THEN BEGIN "No. 2" := Item."No. 2"; MODIFY; END;

    Maybe it would be interesting to filter by date, since it will reduce the impact on performance:

    docs.microsoft.com/.../setfilter-function--record-

  • Hannes Holst Profile Picture
    Hannes Holst 5,767 on at
    RE: Table relation is not visible in sales - line

    hi,

    You must fill the new field with data.

    It's code similar like this:

    Table 37, Field "No." - OnValidate()
    
    IF ItemRec.GET("No.") THEN
      "No. 2" := ItemRec."No. 2";


    Keep in mind, this kind of code would transfer data into "No. 2" only for new records.
    You would have to update existing records with a report or codeunit as an extra step.

    PS: Alternativly, you could change the field definition to "FlowField". Then, NAV would lookup the value automatically. (But you cannot input data by yourself.)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans