Inserting New Line in a rext file

hi I am using Navison - 3.10. I am trying to make dataport that will export data to text file from the Sales Header table. i want to write some thing to the file before the export start and after the export end, Below is format that i desire BeginSalesHeader “Order”,“10000”,“101001”,“10000”,“01/05/01”,“01/04/01”,“01/04/01” “Order”,“01445544”,“101002”,“01445544”,“01/20/01”,“01/20/01”,“01/20/01” “Order”,“32656565”,“101003”,“32656565”,“01/11/01”,“01/08/01”,“01/08/01” EndSalesHeader I am facing problem to insert new line through C/AL code. Can this be done through C/Al Code. IF this is possible i will also like to know how i will skip the extra tags while importing it to Attain though dataport again. with regards ritesh

Sorry friends The Topic should be Inserting New Line in a text file… as rext was mistyped. ritesh

Here the sample code for u IF customer.FIND(’-’) THEN BEGIN IF customerfile.TEXTMODE(TRUE) THEN BEGIN IF customerfile.CREATE(‘c:\customer.txt’) THEN BEGIN IF customerfile.OPEN(‘c:\customer.txt’) THEN BEGIN //You can write the head what ever u r want here customerfile.WRITE(’ Head u can write here ‘); REPEAT customerfile.WRITE(FORMAT(customer.“No.”,10) + ’ ’ + FORMAT(customer.Name,30) +’ ’ ); UNTIL customer.NEXT =0; END; // write the end points customerfile.WRITE(‘Ending’); customerfile.CLOSE; SHELL(‘notepad c:\customer.txt’); END END END // Varible u have to define in the symb… Name DataType Subtype Length customer Record Customer customerfile File

Wouldnt be easier just to use f.textmode := true; statement, where f is variable of type File. The code snippet below is self-explainable I believe: Variables: f: file; SalesOrderHdr: Record: Sales Header; f.textmode := true; f.create(‘c:\SalesOrderHdr.txt’); if SalesOrderHdr.find(’-’) then repeat f.write(format(SalesOrderHdr)); until SalesOrderHdr.NET = 0; f.close; This will write a “Tab” delimited file containing all the fields of the Sales Header table row by row in the file c:\SalesOrderHdr.txt. If you want to have a semi-colon delimited file with just selected fields then you can define a Text or Code. For example: var WriteBuf : Text: 1000; f: file; SalesOrderHdr: Record: Sales Header; f.textmode := true; f.create(‘c:\SalesOrderHdr.txt’); if SalesOrderHdr.find(’-’) then repeat WriteBuf := STRSUBSTNO(’%1;%2;%3;%4’, SalesOrderHdr.“Field1”, SalesOrderHdr.“Field2”, SalesOrderHdr.“Field3”, SalesOrderHdr.“Field4”); f.write(WriteBuf); until SalesOrderHdr.NET = 0; f.close; everything else is the same as the above.