Dataport Export multiple tables to multiple text files

rsaritzkyrsaritzky Member Posts: 469
Hi,

I have 3 dataports that export posted invoice data to an external system - they each export into their own text file:
Sales Invoice Header
Sales Invoice Line
Sales Comments

The dataports all work fine.

I would like to allow the user to export all 3 text files using one dataport. Each dataitem, however, needs to continue to be exported separate text files.

I know that I could, for example, create a ProcessingOnly Report that would call each dataport in succession, building in functionality to set the proper export filename, etc.

I'm trying to determine if there is an easier way.

I've used the technique for collecting the export filename via a custom request form, so I'm familiar with that.

I'm not sure, however, if I can use the CurrDataport.FILENAME function to change the file name at the beginning of each dataitem in the dataport.

Does anyone know for certain? Or is it time for the "Just try it and see if it works" method <grin>.

Thx

Ron
Ron

Answers

  • David_SingletonDavid_Singleton Member Posts: 5,479
    rsaritzky wrote:
    I'm not sure, however, if I can use the CurrDataport.FILENAME function to change the file name at the beginning of each dataitem in the dataport.

    Does anyone know for certain? Or is it time for the "Just try it and see if it works" method <grin>.

    In all seriousness, did you try it? It would probably have taken you less time to try it than to write out all this as a question.
    David Singleton
  • rsaritzkyrsaritzky Member Posts: 469
    Actually it took me only a minute to write the question, and will take more time to test it/try it than that. But I WILL try it and post my results.

    Thx

    Ron
    Ron
  • rsaritzkyrsaritzky Member Posts: 469
    For the benefit of others, I did complete testing this, and you CAN create separate export files in a multi-dataitem dataport.

    I prompted the user for the path and "base" portion of the filename, e.g. C:\EXPORTS\BATCH123 (this stored in a global variable "Filepath")

    Then, in the OnPreDataItem section of the first (header) dataitem, I entered:

    CurrDataport.FILENAME := Filepath + '_header.txt';

    In the second dataitem:

    CurrDataport.FILENAME := Filepath + '_line.txt';

    and in the third:

    CurrDataport.FILENAME := Filepath + '_comments.txt';

    Result was exactly what I was hoping for - 3 separate export files.

    Ron
    Ron
  • David_SingletonDavid_Singleton Member Posts: 5,479
    :thumbsup:

    Wax on Wax off 8)
    David Singleton
  • davmac1davmac1 Member Posts: 1,283
    You can use the same method to import multiple files as well.
    :D
  • raveendran.sraveendran.s Member Posts: 119
    Thanks, I was in need of this solution. I got it...
    --
    Regards,
    Raveendran.BS
Sign In or Register to comment.