Troubleshooting
Problem
JavaScript - Appending data to a text file.
Resolving The Problem
Software versions for: OS: Macintosh, Windows
FileNET Software: Informed Designer
Steps to verify that this problem applies: N/A
Steps to resolve the problem:
This script allows for appending data to an existing text file:
//Declare some variables
var cellName, cellData;
//Specify a few shortcuts
theRec = Informed.currentDocument.currentRecord;
cellName = theRec.Cell("Write Me To A Text File");
//Commit the record to make sure the calculated data to be written to the text file is current
theRec.commit();
//Get the cell data first
cellData = cellName.get()
//Open the text file
ref = FileIO.ioOpen("C:\\Informed\\Accounts\\TheBigPO\\Test.TXT");
//Get the length of existing data in the text file
fileEnd = FileIO.ioGetEOF(ref);
//Set the mark to the end of the existing data
FileIO.ioSetMark (ref, fileEnd);
//Add the data and add a carriage return/line feed for importing the text file into the database
FileIO.ioPuts(ref,cellData,EOL_CRLF);
//Close the file
FileIO.ioClose(ref);
NOTE
The output file must exist, A routine is not included to create the file if it does not already exist (although this can be done using the SEFileIO plug-in ioCreate method).
This method adds a carriage return and line feed character to the end of the added data. This is so the text file can be imported that much easier into a potential database if necessary.
Historical Number
10006770
Product Synonym
FORMS MANAGER DESIGNER
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg21275560