CofC lines restricted to Sales Lines

SevententhSevententh Member Posts: 10
Hi all,

I'll start by saying I'm a newbie to NAV design/coding... but will 10+ years in .NET/C# development..

Task: To design a new table/form/Reports for Certificate of Conformity (CofC)... all data is based on Sales Header & Sales Line tables.
Table: CofC Header; CofC No (Code), Sales Order No (Code - TableRelation "Sales Header".No.), + other fields
Table: CofC Line; CofC No (Code), Line No (Int), Item No. (Code - TableRelation "Sales Line".No. WHERE (Document No.=FIELD(Sales Order No)) )

Designing the Header table is not a problem. I can select the Sales Order, and the other fields 'Customer, Address' get filled in

The problem: I want to be able to lookup / restrict the CofC Line to only show Items that are on the 'Sales Line' (as selected in the CofC Header)
but when I select the Lookup for the Item No, I get the following error:

The following field must be included in the table's primary key
Field: No.
Table: Sales Line


How can I design this..?

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I doubt this relation
    (Code - TableRelation "Sales Line".No. WHERE (Document No.=FIELD(Sales Order No)) )

    "Sales Line".No. this should point to headers no.
  • SevententhSevententh Member Posts: 10
    I found a solution that kind of works... but still doesn't show me the Item No!

    Needed to add field "CofC Line"."Sales Order No." then do a FlowField and calc Lookup("CofC Header"."Sales Order No" WHERE (CofC No=FIELD(CofC No)))
    Field "Item No." has a TableRelation of "Sales Line"."Document Type" WHERE (Document No.=FIELD(Sales Order No))


    The CofC Header has a SubFormLink CofC No=FIELD(CofC No),Sales Order No=FIELD(Sales Order No) on the SubFormID CofC List

    This now only shows Items from the Sales Order List... But how do I get it to display the Item No. ? It currently displays ORDER due to selecting Document Type above.>!

    Question 2: How do you increase the Line No. step 1000 (like Sales List)??
  • ReinhardReinhard Member Posts: 249
    There is a property called "AutoSplitKey" that does the 10,000 line no. increase. There are other times you have to simply code it.

    I think the table relationship you are looking for in your earlier question...

    When the Sales Order No. is filled in on the header, you have to populate this to the CofC lines as well. When new lines are inserted, copy the Sales Order No. from the header.
    Then you can create a new CofC Line field called "Item No." with table relationship:
    "Sales Line"."No." WHERE
    Type=Item, "Document Type"=Order, "Document No."="Sales Order No."

    So really they have to select a sales line.
Sign In or Register to comment.