Use an Object by reference?

Hi,

I don't remembered if is possible to run a Object by reference and call the object's function?

For example: I am write a process report to import and process data. Report calls different XMLPort based on a setup table. The underline table for XMLPort is a temporary table and I have function to pass the record out. I am use XMLPort.IMPORT("XMLPort No.", InStream), but I can't call the function to get the record back in the process report. In the future, if there is a new format of text file, all I need to do is create a new XMLPort and update setup table. I don't want to create new xmlport variables in the report.

Thank you,


Answers

  • TallyHoTallyHo Member Posts: 415
    If it is a temp table, store it in a single instance codeunit onpostxmlport. Get the content of the table from the cu after the XMLport is run.
  • foreverblue80foreverblue80 Member Posts: 11
    I don't think I have the same instance after xmlport is run.

    XMLPort.IMPORT(50000, InStream);

    After this line, the instance is gone.
  • foreverblue80foreverblue80 Member Posts: 11
    BTW, I don't have development license. Everything I do is in Report and XMLPort.
  • TallyHoTallyHo Member Posts: 415
    edited 2019-06-14
    > @foreverblue80 said:
    > BTW, I don't have development license. Everything I do is in Report and XMLPort.

    In that case.. my suggestion is not the solution.
  • foreverblue80foreverblue80 Member Posts: 11
    @TallyHo

    Could you show me how would you write it? Maybe I take the idea and modify it. I am using process report like codeunit.

    Currently my program is process report on the page. The process report will call different xmlport based on a setup table to import different format of files.


  • TallyHoTallyHo Member Posts: 415
    edited 2019-06-14
    I'm sorry, my idea is only possible using a codeunit. Only a codeunit has the 'SingleInstance' property. If you activate this, the instance of your temp rec can be saved in this codeunit, not only during runtime of your process, but during the whole current active NAV session.
  • foreverblue80foreverblue80 Member Posts: 11
    I totally forgot about that. lets see if I can borrow license from my ex-coworker. LOL. Thanks.
    I wish Nav can reference any Objects like RecordRef and FieldRef to tables.
  • TallyHoTallyHo Member Posts: 415
    You're welcome, good luck with it!
  • foreverblue80foreverblue80 Member Posts: 11
    I have the program done, but would like to refine it. I just don't like import, process data, and save to a real table in the xmlport. More than 70% of coding is been duplicate every time I create a new xmlport.
  • JuhlJuhl Member Posts: 724
    Follow me on my blog juhl.blog
Sign In or Register to comment.