write to textfile without CRLF

Hello, (NF2.6) I have a table with about 150 fields. For each record, each field must be writed into a textfile with special formating (so dataport is not good). I trying to write to a textFile : FTxt.TEXTMODE(TRUE); FTxt.CREATE(‘c:\file.txt’); FTxt.WRITE(‘aaaa’); FTxt.WRITE(‘bbbb’); FTxt.CLOSE; But with that, I have 2 lines. And I would to write without CRLF, on only 1 line I want to do Ftxt.Write(field1); Ftxt.Write(field2); … Ftxt.write(CRLF); … Without doing Ftxt.write(field1+field2+…) It’s too hard to do With TextMods = False, There are some strange character in my file. How is it possible to do that?? Thx

You are right, When TEXTMODE=TRUE, the write function writes a line. So it puts CR/LF at the end of each line. One simple way would be to have a variable that you are filling, and then write this variable. Ex: //MyLine is Text 1024 FTxt.TEXTMODE(TRUE); FTxt.CREATE(‘c:\file.txt’); MyLine := MyVar1 + MyVar2 + MyVar3 FTxt.WRITE(MyLine); FTxt.CLOSE; But then, you would have to take care about the 1024 chars limit. So, maybe FTxt.WRITE(MyLine1 + MyLine2 + …), but I didn’t try

Hello Geoffrey, (nf310/360)I’ve found in Client Side Reference Guide by typing ‘Write text’ in keyword to find following: - OutStream.WRITETEXT - Use this function to write text to an OutStream object. - Data is written in text format. - [{Written} := ] OutStream.WriteText([Text, [Length]]) Does it correct? It should generate Win-1251 text but not ASCII one. It is not tested. BR Anthony

Try this FTxt.TEXTMODE := TRUE; FTxt.CREATE(‘c:\file.txt’); FTxt.WRITE(‘aaaa’); FTxt.SEEK(FTxt.POS - 2); FTxt.WRITE(‘bbbb’); FTxt.SEEK(FTxt.POS - 2); FTxt.WRITE(‘cccc’); FTxt.CLOSE; FTxt.OPEN(‘c:\file.txt’); FTxt.SEEK(FTxt.LEN - 2); FTxt.TRUNC; FTxt.CLOSE; /Bjarne

What are the reasons for rejecting a dataport? All fieldformatting can be done in the trigger OnAfterFormatField.

Solution from Bjarne is good. For David, On NF2.6, max text length is 255. But my lines is more than 1000 characters for Kopyurf, I use NF2.6, ther isn’t outstream For sv, text formatting is special, but also delimiter. Sometimes, field delimiter is #, somestimes, @, …

I like Bjarn’s approach (just because it looks fancier). I tend to favour doing the advanced file export in code, but thats perhaps because old habits die hard. Although, I believe that formatting is defintly an option in dataports…see “FieldStartDelimiter” & “FieldEndDelimiter” properties…

quote:


For sv, text formatting is special, but also delimiter. Sometimes, field delimiter is #, somestimes, @, …


I don’t want to push my point further, if you prefer to use a report, but your task (it seems) can easily be solved with a dataport. If you put in the dataport-properties FieldStartDelimiter, FieldEndDelimiter (and even FieldSeparator if necessary) you can control everything from the OnAfterFormatField trigger of each field. E.G.: OnAfterFormatField(VAR Text : Text[1024]) Text := MyStartDelimiter + Text + MyEndDelimiter ( + MyFieldSeparator); The formatting should/could be done via a few functions (this, of course, also applies to Bjarne’s solution [;)]).