Navision 4 Dataports Question

dkajfesdkajfes Member Posts: 7
Hello to everyone,

I have a client who has been using Navision 4 for approx 18months now.

I need to create a dataport to export information from the sales invoice line table and the sales invoice header table.

The dataport needs to export invoices in the range the user selects to a text file to be imported by their EDI software.

I am aware that i can't indent using standard dataports.

The issue i face is that i need all the information for an invoice on one line.

ie. Header info, followed by line info

The header info is repeated for each line if there is more than one item on the invoice. (the edi program will use the header info to group the lines together back onto an electronic invoice)

Is there a way to do this using dataports?

I am not very familiar with Cside porgramming, but do have some basic understanding. The client has not paid for the programming module.

Can i add code in the C/AL editor under the SalesInvoiceLine dataitem to get the data from the SalesInvoiceHeader table and put the data into variables, then write the variables out as a dataport field?

How would i code this?

Thanks for your help.[/b]

Answers

  • DenSterDenSter Member Posts: 8,305
    You'd have to:
    1 - sort the line dataitem by document number (which is part of the primary key)
    2 - every time that the document number changes, you get the associated header, and you move the values you need into global variables, although it might work to reference fields of a record variable (haven't tried that one yet)

    You program this in the OnBeforeExport trigger of the line.
  • dkajfesdkajfes Member Posts: 7
    DenSter wrote:
    You'd have to:
    1 - sort the line dataitem by document number (which is part of the primary key)
    2 - every time that the document number changes, you get the associated header, and you move the values you need into global variables, although it might work to reference fields of a record variable (haven't tried that one yet)

    You program this in the OnBeforeExport trigger of the line.

    Thanks. This is where i get stuck. I have limited knowledge of C\Side programming.

    How do i move the values into global variables?

    Do i use the Get function (how do i grab the actual values)

    ie myvariable := ???????

    Thanks
  • SavatageSavatage Member Posts: 7,142
    Using the salesInvline as the dataitem. it would some thing like this.
    Example Variables:
    SalesInvHeader - Record - Sales Invoice Header
    vName - Text - 60
    vAddress - Text - 60
    vCity - Text - 60
    vZipCode - Text - 60
    (you can add which ever fields you need to get)
    SalesInvHeader.Get("Document No.");
    vName := SalesInvHeader.Name;
    vAddress := SalesInvHeader.Address;
    vCity := SalesInvHeader.City;
    vZipCode - SalesInvHeader.ZipCode;
    

    When you look at view->dataport fields
    this is where you enter that variable names manually
    vName
    vAddress
    vCity
    vZipCode

    and the salesinv line fields you need

    There is a whole section in the application designers guide on dataports if you need additional info. It's available online or your product cd.
  • dkajfesdkajfes Member Posts: 7
    Savatage wrote:
    Using the salesInvline as the dataitem. it would some thing like this.
    Example Variables:
    SalesInvHeader - Record - Sales Invoice Header
    vName - Text - 60
    vAddress - Text - 60
    vCity - Text - 60
    vZipCode - Text - 60
    (you can add which ever fields you need to get)
    SalesInvHeader.Get("Document No.");
    vName := SalesInvHeader.Name;
    vAddress := SalesInvHeader.Address;
    vCity := SalesInvHeader.City;
    vZipCode - SalesInvHeader.ZipCode;
    

    When you look at view->dataport fields
    this is where you enter that variable names manually
    vName
    vAddress
    vCity
    vZipCode

    and the salesinv line fields you need

    There is a whole section in the application designers guide on dataports if you need additional info. It's available online or your product cd.

    Thanks Mate, you are a legend. Works perfectly.
  • SavatageSavatage Member Posts: 7,142
    Glad to help - please put [Solved] in the orig post topic
Sign In or Register to comment.