list_file
Saves a list.
Available in:
Apps (win) |
Apps (char) |
Reportwriter |
RPC |
Standalone PL |
X |
X |
X |
X |
X |
Syntax
void list_file(list-name,file-name,file-type[,save-col,...])
list list-name
string file-name
string file-type
expr save-col
Description
Saves a list to a specified location.
list-name | specifies the list to save.
|
file-name | specifies the name to save to.
Whenever a file name is specified the extended file names are available.
Be sure to give a complete file
specification.
|
file-type | specifies the type. Values can be:
File type |
File format |
a[a][sc[q]] | Text. [a] appends to text file.
If [sc] is not specified, then all columns are stored as one text line.
[sc] stores
the file with columns separated by c. For example, "as," creates a
new comma
separated data file; "aas," appends to an existing file. Non-integer numerics
will be written in scientific notation. [q] specifies q as the
character column quote
character. For example, "as,'" creates a new comma separated data file with
character column data delimited by "'".
|
b[a] | Binary. [a] appends to binary file.
Maintains list's column structure, but loses column names.
|
j[b][h][n][p][o][r] | Text, JSON format. list consists of
"name:value" pairs stored as two columns (any additional columns are ignored).
If "value" is an array of items, then
it must be a one column list of zero or more items. If "value" is an object,
then it is a two column list of "name:value" pairs. This is the default behavior
(same as specifying p).
If b is specified, then integer values are mapped to boolean.
If h is specified, then a head: portion is added.
If n is specified, then a column name: portion is added.
If o is specified, then object "{}" layout is prioritized over array "[]" layout.
If r is specified, then the data: portion is omitted. This option is ignored if p is specified.
|
s[n] | Shared memory. [n] allocates a new shared memory segment.
|
x[d] | Text, XML format. Maintains list's column structure and column names as well as recursive list structures. [d] stores only the data as text file in XML format.
|
|
save-col | (optional) specifies the columns to save.
Column numbers can be any expression that evaluates to either an integer or
a char string containing space-delimited
integers or any combination of these.
The default is
all columns.
|
Notes
To use the shared list option, the TRIM_SHM_FILE environment
variable must point to a valid file-name. Also, when using the
shared list option, save-col is ignored; in other words, all
columns are stored.
If you use the "?a" append option, the first list_file() call must not have the append option.
Columns whose width has been set to zero via list_colwid() will not
be exported by default. The save-col option must be used to specify
the columns in this case.
Example
Saves the parts list for later use.
list_file(xx,"parts.lst","b");
Prints part descriptions.
list_file(xx,"/dev/lp","a",1);