TextIo.write Method

Writes data to a file represented by a TextIO object.


public boolean write( values)

Called

Parameter

Description

values

The values to write to the file. The values can be of different data types.

true if the write operation succeeds; otherwise, false.

If the write operation fails, TextIo.status Method can be used to ascertain the cause. The write method accepts a variable number of arguments. Each value is put into the output record as a field. The fields are separated by the field delimiter specified by the TextIo.outFieldDelimiter Method. Each record is separated by the delimiter specified by the TextIo.outRecordDelimiter Method.

To write complete containers, use the TextIo.writeExp Method.

The following example writes data to a TextIO object called file.

protected void headingRecord()
{
    ;
    outputTxt = strdel(outputTxt, 1, strlen(outputTxt));

    outputTxt += this.recordCode(#PresenterHeadingRecordCode);
    outputTxt += dataCode;
    outputTxt += strLFix(CompanyInfo::find().VATNum, #NIF);
    outputTxt += suffix;
    outputTxt += strRFix(this.applyDateFormat(systemdateget()), #Date, '0');
    outputTxt += strrep(' ', 6);
    outputTxt += strLFix(strupr(CompanyInfo::name()), #Name);
    outputTxt += strrep(' ', 20);
    outputTxt += strRFix(
        BankAccountTable::accountNum(
            custVendPaym.ledgerJournalTrans().BankAccountId),
            #RegNum, '0');
    outputTxt += strrep(' ', 12);
    outputTxt += strrep(' ', 40);
    outputTxt += strrep(' ', 14);
 
    outputTxt = strLFix(outputTxt,recordLength);
 
    file.write(outputTxt);
}

Community Additions

ADD
Show: