How to execute/convert a Dataport in NAV6 RTC.

albert_1982albert_1982 Member Posts: 33
edited 2009-09-15 in NAV Three Tier
I´m migratting a Nav5 Form to Nav6 CC/RTC.

When the user push a botton, the following code executes a dataport. The dataport ask th e user for a .txt file path and then import the data of the .txt file .

<Control1000000001> - OnPush()
DataPortImportN43.SetBanco("No.");
DataPortImportN43.RUNMODAL;

I read some toppics and it seems that we have 3 options:

1) Create a new report and program the code to read the txt file.
Problem: (To much hours programming, and 1 new report object).

2) Create a new report, without layout, ask the file path in the requestform and program to execute the existing dataport.
Problem: (1 new report object, works in RTC and CC????).
LInk founded: http://www.dynamicsblog.at/index.php/20 ... -xml-ports

3) Create a new XmlPort that read the txtfile and import the data.
Problem: (Program or ?Convert? XmlPort , 1 new xmlPort object, What about execute in CC?, where to ask for the path?)

Do you know what is the best option? Is there another option?

Thank you very much.

Comments

  • ara3nara3n Member Posts: 9,256
    You have pretty much summarized the options.

    I would go with xmlport option. Mainly so that I don't have to do any file handling and reading the file.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    3) Create a new XmlPort that read the txtfile and import the data.
    Problem: (Program or ?Convert? XmlPort , 1 new xmlPort object, What about execute in CC?, where to ask for the path?)

    Do not forget that the XMLPort will run on Service tier, not on client PC. If the imported file is on client PC, you need to use UPLOADINTOSTREAM to read the file. This function include the open dialog automatically. It just return you the stream from which the XMLPort will read the data.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • albert_1982albert_1982 Member Posts: 33
    Trying option 2 I have a problem, i can´t send a paràmeter from the report to the dataport.
    Do you know if this is possible and how? Thanks

    Example:

    Form / Page
    The button of the form, and the action of the page, executes that code:
    ReportImportN43.SetBank("No.");
    ReportImportN43.RUNMODAL;

    Report:
    Report - OnPreReport()
    //** How to send the var Bank2 to the dataport? I can´t declare a variable as dataport . So I can´t execute
    // something like //N43DATAPORT.SetBank2(Bank2), that works in the previous versions.
    DATAPORT.RUNMODAL(57100);

    SetBank(Bank : Code[20])
    Bank2 := Bank;

    Dataport

    SetBank2(Bank2 : Code[20])
    BankCode := Bank2;
  • albert_1982albert_1982 Member Posts: 33
    Looking for option 3) Xmlports

    Is there any tool to convert Dataport to Xmlport? How to convert it?

    Thanks
  • ara3nara3n Member Posts: 9,256
    There is no tool. You have to do it manually.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • albert_1982albert_1982 Member Posts: 33
    Thanks ara3n.
  • ara3nara3n Member Posts: 9,256
    you are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ievasimplanovaievasimplanova Member Posts: 45
    for converting Dataports to XMLports you can try automated Simplanova Dataport Converter tool, which automates up to 90% of manual work
    Tired of Dynamics NAV Report Upgrades? - Convert automatically Classic NAV reports to RDLC format with Simplanova Report Converter
Sign In or Register to comment.