How to import data from .CSV file using a Report

dilladilla Member Posts: 31
Hi All,

I'm using Navision 3.70 and I have a requirement to import data from a .csv file in to General Journal. The.CSV file includes the fields Posting Date, Doc. No., G/L Acc type, Acc No. and Amount.

I created a table to define the format of the .CSV file because the order of fields in .CSV file are different from one file to other.

By using a Report,now I need to import data from .csv file in to General Journal.


Can any of you please help me, how can I create a Report in order to import the data.

Thanks in advance.

With Regards,
Dilla

Comments

  • JedrzejTJedrzejT Member Posts: 267
    Hi,

    Can I ask why You want to use Report for this import (instead of Dataport)?
    Create One dataport per one file format is not good solution?
  • matttraxmatttrax Member Posts: 2,309
    I agree. Using a report doesn't make any sense. You can do the same thing with a Dataport (even the different column order).
  • dilladilla Member Posts: 31
    Hi All,

    Thanks to all of you for your valuable inputs.

    As per the requirement I should use only Report, I created a new Report and by using Excel Buffer Table some how I mangaged to import the data from .CSV file in to General Journal. .CSV file contains data for 21 fields for each record in a single shell seperated by ";".

    Two problems I have now are:

    1. If I have 2 records in .CSV file, first record is getting imported first and then it is over written by the second record.

    2. If .CSV file does not contain data for all 21 fileds, emty fields are seperated by a ";" and I'm receiving an error message. How can I handle the empty fields.

    Kindly revert for further information
  • Cem_KaraerCem_Karaer Member Posts: 281
    In the properties of the report (go to the lowest, blank line in the dataport and press Shift+F4) set FieldStartDelimiter <None> FieldEndDelimiter <None> and FieldSeperator ; (write it as exactly seen)
    Cem Karaer @ Pargesoft
    Dynamics NAV Developer since 2005
  • matttraxmatttrax Member Posts: 2,309
    dilla wrote:
    As per the requirement I should use only Report

    The requirement is to get the data into NAV and use a method that still works in NAV 2009 from what I understand. The requirement is NOT to use a report to get the data. You could just as easily use a codeunit or a dataport. Functionality is a requirement; how you build that functionality usually is not.

    Why are you using the Excel Buffer table? You're writing dataport functionality from scratch so you should have File Streams and be checking for delimiters in your code.
Sign In or Register to comment.