Transfer of data from Excel Buffer to Currency Exchange Rate

aashish1206aashish1206 Member Posts: 4
edited 2011-10-27 in Navision Attain
Hi All,

Can somebody please let me know how to transfer data from Excel Buffer table to currency exchange table(No.330) using a codeunit.

In NAV 2009 SP1 ,We managed to import the data from Excel file to Excel Buffer table using the below functions,

Excelbuf.OpenBook(FileName,SheetName);
Excelbuf.ReadSheet;

Appreciate your help.

Thanks,
Ashish

Comments

  • ufukufuk Member Posts: 514
    Do you want to import from Excel to Curr table or you already imported to Excel Buffer and trying to move it to curr table?

    I will explain it assuming you've already imported to buffer:
    [*]First, it doesn't affect your code if it's written in a codeunit or any other object. Generally they will be similar.
    [*]Create a function in a new or existing codeunit.
    [*]Loop through Excel Buffer by repeat until.
    [*]Map fields in a Init(or Clear) - Insert block.

    Something like:
    ExcelBuffer.FINDSET; // use IF upon your requirements
    REPEAT
    CurrExchRate.INIT;
    CASE ExcelBuffer."Column No."  OF
    1:
    CurrExchRate.VALIDATE("Currency Code",ExcelBuffer."Cell Value as Text");
    2:
    //evaluate string to date and map to appropriate field ...
    ...
    END;
    CurrExchRate.INSERT;
    UNTIL ExcelBuffer.Next = 0;
    

    Try to complete it yourself. If you couldn't succeed I can help you later...
    Ufuk Asci
    Pargesoft
  • aashish1206aashish1206 Member Posts: 4
    Hi,
    Thanks for your reply.You are right we have already imported the data into Excel buffer table and trying to transfer the data from Excel buffer table to Currency Exchange Rates(No. 330) table.

    I will try this and let you know.

    Appreciate your help.
  • ralphswurldralphswurld Member Posts: 1
    But in you case, we are converting only certain records not all the records. The data comes together in same keyfigure for both company code currency and also EUR currency. In this case you need to check manually and write code to convert it. So you will not be able to do with auto conversion. That applies to completely different scenario.
    What you have done is the correct way.
Sign In or Register to comment.