• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

RE: Dynamic flat file name


Re: Dynamic flat file name


I doubt whether you can change file names dynamically, but
DeleteOrCopyFlatFile function may come handy...
You can try copying the file to another dynamic file name( using a
variable), delete the orginal file and then run DataBase output.

I don't know, someone may have better idea..


Get your FREE download of MSN Explorer at http://explorer.msn.com


Active Member
Re: Dynamic flat file name

The best way I have used of writing to a flat file is not to use database output, as this has restrictions such as only being able to output business view fields not calculated fields, but to use the business function 'Export to Flat File'(B0500025).

Perhaps dtabase output has been improved for XE though.

Within the business function you can specify the file name as a parameter, so the path could come from a processing option for example, and could be a server name such as \\myserver\myfile.txt

You will have to write code to write data into this file line by line, the business function will append when the file already exists, and create a new file when it does not - I often use a date/time stamp in the filename to keep them unique. You can create .txt files or .csv file this way...

Hope this helps

Tom Brown


Re: Dynamic flat file name

The information in this e-mail is intended only for the named
recipient and may be privileged or confidential. If you are
not the intended recipient please notify us immediately and
do not copy, distribute or take any action based on this e-mail


Hi Carlos,

The way I get round this is to output to the specified filename from my Table Converter (same for UBE I think) but have this table converter wrapped in a UBE which takes this file and renames it when the TC is finished. This is allowing me to call the TC multiple times in one run and output different named files each time. Business Function B0500180 'Operating System File Operation...' is handy for doing the file rename. (Thats in Xe, don't know if it is in earlier releases, if not I have C code to do the same thing if you need it)

Hope that helps

Hi list,

Client would like to be able to have a dynamic flat file name created each
time he performs the database output and runs a report. For example, when
doing a normal database output, you must specify what will be the name of
the flat file and where it will be created. Run a report and the flat file
is created. If you were to run the report again, the client would like to
have a new flat file name created automatically(i.e. flatfile1.xls,
flatfile2.xls, flatfile3.xls).



Working at Miller Group, Edinburgh, Scotland
OneWorld Xe sp13 - Oracle - on Solaris and NT


Re: Dynamic flat file name

// NOTE : to download OneWorld file to .csv format in MSExcel

If PO szFileName is equal to <Blank>
PO szFileName = "c:\default.csv"
Delete Or Copy Flat File <==== this is a BSFN
End If

I had to do this once and erm..... hope this might give you a lead on what to do. First, create a processing option where the user may input the directory where he wants to store the file. Suggest to use a long dd item. After attaching the Processing option to the report, use the "database output" feature and ensure that the necessary fields are all being used for output accordingly. In the report header and footer, use the above code and pass the parameters accordingly. User should be prompted to enter a filename with the proper pathcode (where the file is supposed to be stored), everytime the report is run.

Hope this gives you a lead.

One World b7332 SP 11 NT SQL 7.0