Add Ship-to Name to Invoice Lines Subform

gadzilla1gadzilla1 Member Posts: 316
I would like to know the best Navision way to achieve the following:

From the Sales Order please select Sales History, then Posted Invoices.

The Posted Invoices selection displays the Invoice Lines Subform (Sales Invoice Line as SourceTable).

The customer would like to see the 'Ship-to Name' field display in the Invoice Lines Subform. The Ship-to Name field is in the Sales Invoice Header table however, and NOT in the SourceTable Sales Invoice Line.

Does anyone have any ideas? I've completed similar tasks and have worked on this...but some posts made me wary of working with this Subform.

Any help is greatly appreciated. Have a great day.

gad1

Answers

  • DenSterDenSter Member Posts: 8,305
    Maybe the easiest is to add a lookup flowfield to the invoice line table that looks up the value in the header table. This could have performance issues though. You could also add the field as a normal field and make it non editable, and populate it through header field validation, or maybe add populating it to the posting routine.

    Lots of possibilities :mrgreen:
  • gadzilla1gadzilla1 Member Posts: 316
    Negfligible performance issues? Are they ever? ;)

    That would be the easiest for sure.
  • David_CoxDavid_Cox Member Posts: 509
    Yep the flowfield would be one way to go, but I.M.H.O not the best, so why not just add a static field to the Sales Invoice Line, that is populated in the posting codeunit Sales Post, then there are no flowfield process overheads when viewing the form and speed, searching and flitering are also better.

    Dave
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • gadzilla1gadzilla1 Member Posts: 316
    Thanks All,

    David: In regards to the two options...for the flowfield, will the performance issues be local to that form only?

    If so I'll do that, because I haven't touched any codeunits just yet, and will take the decreased speed if it's just with that form. Thoughts?

    Take care - gad1
  • DenSterDenSter Member Posts: 8,305
    The flowfield will cause round trips to the server, because it has to look up the value in another table. On list forms especially, this will cause BIG performance problems. It depends on how many records are usually in the form. If it's just a few then it's not a big issue (unless it is used by many people at the same time), but if the form shows everything in the table and you want to go scrolling through the list, you should definately not go with flowfields.

    I agree from a performance standpoint it would be best to add the field to the table and populate it in the posting routines. It's redundant though, and you need to check if your header lets you modify the field on the header after posting, so you can have that update the lines as well.
  • gadzilla1gadzilla1 Member Posts: 316
    Thanks for the reply. When you said:

    "I agree from a performance standpoint it would be best to add the field to the table and populate it in the posting routines. It's redundant though, and you need to check if your header lets you modify the field on the header after posting, so you can have that update the lines as well."

    Is there a C/AL sample existing on a table in the Navision database (every one) that you can point me to as a reference?

    For instance, in Table 36 Sales Header: In the Sell-to Customer No. - OnValidate() trigger, I see something like

    "Sell-to Customer Name" := Cust.Name;

    Is it something like this that you're referring to?

    Thx - gad1
  • David_CoxDavid_Cox Member Posts: 509
    It not hard at all. add a field to the Sales Invoice Line table 113 Field 50000 "Ship-to Name" type text look at the sales header table for lenght 30 or 50 for GB

    The codeunit 80 Sales-Post is called with the Sales header and the fields are transfered to the Sales Invoice Header and we need to take one to the line so its as easy as this find the code below, and Insert one line of code befor the Insert:
          IF Invoice THEN BEGIN
            // Insert invoice line or credit memo line
            IF "Document Type" IN ["Document Type"::Order,"Document Type"::Invoice] THEN BEGIN
              SalesInvLine.INIT;
              SalesInvLine.TRANSFERFIELDS(TempSalesLine);
              SalesInvLine."Document No." := SalesInvHeader."No.";
              SalesInvLine.Quantity := TempSalesLine."Qty. to Invoice";
              SalesInvLine."Quantity (Base)" := TempSalesLine."Qty. to Invoice (Base)";
             
              //VERSION INFO IE: 
              //GD1.00 20070712+
              SalesInvLine."Ship-to Name" := SalesInvHeader."Ship-to Name";
             //GD1.00 20070712-
    
              SalesInvLine.INSERT;
              DimMgt.MoveOneDocDimToPostedDocDim(
                DocDim,DATABASE::"Sales Line","Document Type","No.",SalesInvLine."Line No.",
                DATABASE::"Sales Invoice Line",SalesInvHeader."No.");
              ItemJnlPostLine.CollectValueEntryRelation(TempValueEntryRelation,SalesInvLine.RowID1);
            END ELSE BEGIN // Credit Memo
    

    Then add the new field to the Form

    :D
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • themavethemave Member Posts: 1,058
    The best way is to buy this add-on

    http://www.costcontrolsoftware.com/Direct%20Purchasing.htm

    it already has the coding done for you, and it gives them a very well integrated drop ship ability, the ability to have resources on PO's a Sales Order history file, and more, for probably what it will cost to have just this change done, that is being suggested above.

    this addes the ship-to code to the sales line.

    Just an idea anyways, and no I don't work for the company, we just use the add-on, so as I was looking at your problem, at first I didn't understand what was wrong, since my database has the ship-to code there already.
  • themavethemave Member Posts: 1,058
    I don't have access to cal/code in forms, so I can't give the specifics, but copy the functionality in form 291 Req, worksheet.

    it displays using a variable, the vendor name, based on the requsition line you are on for the item. You should be able to do the same thing with the ship-to code for the posted invoice line in the form you are working with.
  • David_CoxDavid_Cox Member Posts: 509
    themave wrote:
    I don't have access to cal/code in forms, so I can't give the specifics, but copy the functionality in form 291 Req, worksheet.

    it displays using a variable, the vendor name, based on the requsition line you are on for the item. You should be able to do the same thing with the ship-to code for the posted invoice line in the form you are working with.

    Hi themave
    We had offered this as a solution, but variables and flowfields have an overhead on the server, with the static field, you can filter and search it will be faster, it can be added to a report if required with futher no coding.

    So we have 3 solutions for Ship-to Name:
    Lookup to a variable
    Flowfield from the header
    Static Field

    Each will take about the same time to action, with the static field if you want to populate the history, you can do this via a two level report.

    I am assuming that Gad1 is a new developer, but it would be nice if this was in signatures so we can give appropriate replys.

    Gad1
    As your earlier question about performance, to test this, save the item list form with a new number, add a few flowfields, there are a lot on the item table, but these are only calculated as you view the form, Hide and show the fields and page up and down as a test.

    Warning Note:
    If any flowfields are editable, remove them from the list, because if you alter the value you will corrupt the data, the budget values are editable flowfields.
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • gadzilla1gadzilla1 Member Posts: 316
    Thanks everyone! This is working, I choose the following option:

    So we have 3 solutions for Ship-to Name:
    'Lookup to a variable'

    Also yes I am a new developer but am picking up things quickly. There's just a lot to do, and it's rarely the same.

    :wink:

    But that's a-ok. Have a great day, I'll mark this as solved.

    gad1
    newer developer
Sign In or Register to comment.