toString Method

Class: Row

Description

This method casts a Row object as a String. This method sends a Row class object to a file or message interface (e.g., sending a ResultSet to a file for export to Microsoft Excel).

Syntax

Row.toString(String delim,String quote,String fmtDate,String fmtBool,String fmtTime)

Parameters

delim

The character used to delimit columns in the output string.

quote

The character that is used to quote String types. If absent or empty, String types are not quoted.

fmtDate

Format supplied to Date.toString().

fmtBool

Format for columns with type Boolean (currently unspecified and ignored).

fmtTime

Format for columns with type Time (currently unspecified and ignored).

Returns

A formatted string. Columns are separated by delim. If quote is supplied and not empty, Strings will be enclosed in quotes by calling String.addQuotes(quote). Date type columns are formatted by calling Date.toString(fmtDate).

When Became Available

Profile v7.0

Example

type ResultSet rs = Db.select( "NAM,XNAME,DOB,TYPE", "CIF")

type IO iod = Class.new("IO")

set iod.directory = sDir

set iod.fileName = sTable.lowerCase()_".csv"

set oid.openParams = "NEWVERSION"

do iod.open()

while rs.next() do {

  type Row row = rs.getRow()

 

  // translate into standard CSV format:

  // * p1: comma separated

..// * p2: doublequote embedded strings

..// * p3: ISO data format

  do iod.write(row.toString(",","""","YYYY-MM-DD"))

  }

do iod.close()

quit