Options

Include Filename on report

evoskouevoskou Member Posts: 3
I created a report that takes data from a dataport, so i import a txt file and then do some data and then upload my data. on the header of the report i want to show the file that was used to import the data for keeping good records because this task is done every day..

how do i do that? anyone? :D

Comments

  • Options
    KowaKowa Member Posts: 918
    You can create a single-instance codeunit ( set under Codeunit properties), Save the file name in a text variable of this codeunit (create a function in the codeunit for this) when importing the data, then read it back out when printing the report.
    The file name will be saved in the single-instance codeunit until the company
    is changed or the database is closed.
    Kai Kowalewski
  • Options
    wochmwochm Member Posts: 26
    Hello Evoskou!
    If I undersand correctly, you have a report that runs a dataport and you want to show file name of the dataport. If so, you may do it that way:
    1. In report create Dataport variable that points out your Dataport. For example Test is a name of Dataport variable.
    2. Next in report type Test.RUNMODAL; - this runs your dataport.
    3. In dataport create function that returns file name. First in dataport you have to assign currdataport.filename to a variable. Otherwise you may receive error message that file is not open. So it may be like this: in OnPostDataport section type:
    FileName := CurrFile.NAME;
    and function (e.g. GetFileName) has one line:
    EXIT(FileName);
    4. Next in report create variable e.g. FileName and type
    FileName := Test.GetFileName;
    after dataport call and you can put variable FileName (report) into report.

    Below you can find my private email. If you want me to send you a test fob of this functionality just send me a request, please.

    Best Regards/Pozdrawiam
    Marcin Woch
    _____________________
    "ANTEI" Woch Marcin
    email: marcinwoch@wp.pl
    tel.: (+48608) 39 46 29
    Poland
Sign In or Register to comment.