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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Table relation is not visible in sales - line

(0) ShareShare
ReportReport
Posted on by 109

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

I have the same question (0)
  • Hannes Holst Profile Picture
    5,767 on at

    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.)

  • Suggested answer
    Guillem Padilla Profile Picture
    427 on at

    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-

  • Yupp90 Profile Picture
    109 on at

    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
    427 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans