Export data from Item table to .txt files by Dataport

billhwang2008billhwang2008 Member Posts: 32
Hi everybody,

I am developing a new Dataport to export data from Item table to text files, almost all are OK, but get stuck in the Delimiter.

The structure of the text files is: "Item Code",Quantity,"Base Unit of Measure"
for example: "PK20010001",12550.00,"PCS"

if use the FieldStartDelimiter & FieldEndDelimiter, the data will be: "PK20010001","12550.00","PCS" , the Quantity also be enclosed in double quotes, how can I remove them? I will be very appreciated for your any reply.

ERP system is Navision 4.0 SP3

Answers

  • krikikriki Member, Moderator Posts: 9,112
    I think it is best to do it all manually.

    If it is an export-only dataport, you better change it to a processing-only report or a codeunit.
    And in it use the FILE-datatype. Writing to a file is than completely under your control. AND your export is ready to be used with NAS and RTC in the future.

    Another possibility is NOT using delimiters, but in that case you need to use variables in which you put delimiters when you want them.

    Generally I only use dataports to export/import data if I have complete control over how/when/and who (=me) the import/export.

    PS: pay also attention to your decimals/dates/times. Depending on the regional settings, the export can change. If someone works with '.' as decimal an another ',', you have a problem. Generally I convert them to strings in which I define the format independent of regional settings.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • billhwang2008billhwang2008 Member Posts: 32
    Hi kriki,

    thanks a lot for your suggestion, today I created a new Report to export data to excel file, for Item Code & Base Unit of Measure are OK, but the values of Inventory are always 0, not the actual quantity. I'm not familiar with the development, have no any idea about it even search and read many previous Posts in this forum.

    Following are the codes, could you please check it for me?
    Item - OnAfterGetRecord()
    Row := Row + 1;
    EnterCell(Row, 1, "No.", FALSE, FALSE, FALSE);
    EnterCell(Row, 2, Description + ' ' + "Description 2", FALSE, FALSE, FALSE);
    EnterCell(Row, 3, FORMAT(Inventory, 0, 1), FALSE, FALSE, FALSE);
    EnterCell(Row, 4, "Base Unit of Measure", FALSE, FALSE, FALSE);
    RecNo := RecNo + 1;
    

    Thanks again.
  • MBergerMBerger Member Posts: 413
    "Inventory" is a flowfield, look up the Calcfields command !
  • billhwang2008billhwang2008 Member Posts: 32
    Hi MBerger,

    It's working, follow your reminding, I added CALCFIELDS(Inventory);, all data are OK, thank you very much.
Sign In or Register to comment.