About write data to a txt file?

Hi, in my lotusscript codes, I need to write some data to a txt file based on some conditions, for example, in a loop, if one record is not found, then I need to write a file, otherwise, no need. So, the entire process will be write data to a txt file then close it, then later, (we assume the file saved on local machine), then open that file again, and write second data to the exiting file, actually, the data should be appended to the exist data in the file. keeping doing this until the loop is ended.

So my question is: how to write this kind of data to a txt file?

Subject: Lookup Write in the Domino Designer help.

Subject: RE: Lookup Write in the Domino Designer help.

For practicing, I tried this example codes in design help,Dim fileNum As Integer, empNumber As Integer, I As Integer

Dim fileName As String, empName As String

Dim empLocation As Variant

Dim empSalary As CurrencyfileNum% = FreeFile()

fileName$ = “data.txt”’ Write out some employee data.Open fileName$ For Output As fileNum%

Write #fileNum%, “Joe Smith”, 123, “1 Rogers Street”, _

25000.99

Write #fileNum%, “Jane Doe”, 456, “Two Cambridge Center”, _

98525.66

Write #fileNum%, “Jack Jones”, 789, “Fourth Floor”, 0

Close fileNum%’ Read it all back and print it.

Open fileName$ For Input As fileNum%For I% = 1 To 3

Input #fileNum%, empName$, empNumber%, empLocation, _

  empSalary@

Print empName$, empNumber%, empLocation, empSalary@

Next I%Close fileNum%’ Output:

’ LotusScript prints out the contents of the file

’ C:\data.txt in groups of four values each. Each group

’ consists of a String, an Integer, a Variant, and

’ a Currency value, in that order.

#########################

I coded in the action button, the code is running without error, but I can not find it - data.txt. from the help, it says the file should be located in c:, but I can not find it.

Any idea?

Subject: It’s not where the comment says

Specifiy the exact location you want the file placed;

fileName$ = “c:\data.txt”

That comment is a bit misleading. I found my data.txt file in \notes\framework

Subject: RE: It’s not where the comment says

Add the path in front of file name works well.Now, my next question is how to append data to an existing file , for example in C:\data.txt?

Let’s say, I created a file under C:\data.txt from start of my program, but in the later executing of the code, I have to write more data to that existing file, actually, it appends data to the data existed in the file, so after my script is finished, I got the entire data in the file row by row appended per execution. So the existing will be opened and closed repeatly many times.

Any idea how to make it working?

Subject: RE: It’s not where the comment says

Lots of ideas, how about posting what you’ve tried to show you are actually trying.

Simple solution, delete the file before you start writing to it.

Look at Domino designer Help for Open

Subject: RE: It’s not where the comment says

Delete file is not option, I want to write all data to one file.Finally, I found I can use

Open fileName$ For Append As fileNum%

the problem is resolved. thanks