SET OUTPUT FORMAT

SET OUTPUT FORMAT

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

SET OUTPUT FORMAT

Establishes the format for data output.

Syntax

SET OUTPUT FORMAT [ NORMAL  |  COMMADELIMITED  |  XML  |  XMLSIMPLE  |  JSON  |  JSONSIMPLE ]

Comments

The value of OUTPUT FORMAT is NORMAL by default. That is, the LIST and OUTPUT commands create output whose format exactly follows the Object Dictionary definitions of the individual fields being output. The SET OUTPUT FORMAT command can be reset to enable these commands to output data in comma-delimited format, XML, or XMLSIMPLE formats.

When using the comma-delimited format, database fields are separated from one another by the current delimiter character. This is normally a comma but can be changed using the SET DELIMITER command. Character-type fields have trailing blanks removed and are enclosed within a pair of text delimiters. This is normally double quotation marks but can be changed using the SET TEXTDELIMITER command. Numeric fields have leading blanks removed.

When using the XML format, database fields are printed using XML conventions. Each XML “record” describes all fields in full detail of the actual record being printed. In other words, each row being printed has sub-rows displaying each field of the row. In turn, each sub-row displays the content of each field.

When using the XMLSIMPLE format, database fields are printed using XML conventions in a simple format. Each XML “record” only describes the field names and their corresponding values.

Fields that are $Null are output using the current SET NULLVALUE string (without text delimiters). If NULLVALUE is a space character, fields that are $Null are output as a pair of text delimiters.

The formats JSON and JSONSIMPLE produce a JSON-structured output. JSONSIMPLE compresses all blanks whereas JSON outputs in a formatted way.

Remarks

The XML,  XMLSIMPLE, JSON, and JSONSIMPLE format options are only designed for output.

A header can be attached to the output document by using the command SET XMLHEADER.

The identification of each row being printed can be changed by means of the command SET XML ROWELEMENT.

Example

set save
set heading off
set nullvalue "$null"
set output fieldlistwidth off
set output maskfield off
set output virtualfield off
set output format commadelimited
set output UnstructuredDoc
list all Customers
set restore
set output maskfield on    % not saved by save/restore
set save
set output format xmlsimple
set xml rowelement "MyRow"
set output MyDoc
list 1 Doc
set restore

See Also

LIST

OUTPUT

Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese