action_="savefile"

<do action_="savefile"> saves the results of a 1010data query as a delimited file on the user's FTP account. (Available as of version 10.25)

Description

If the user has a valid FTP directory and is authorized to save to that directory, and the filename_ attribute specifies a valid file name, then the data resulting from running the given 1010data query is saved under that name to the user's FTP directory as a delimited file.

To get the estimated size of the saved file without actually saving the file, omit the filename_ attribute and examine the package saved to the dynamic variable associated with the value_ attribute.

Syntax

<dynamic var="{pkg(;)}">
    <do action_="savefile" filename_="filename" 
     sep_="[FIELD_DELIMITER]" 
     recsep_="[RECORD_DELIMITER]" 
     eof_="0|1" formatted_="0|1" 
     names_="0|1" labels_="0|1" 
     value_="@var" checkname_="checkname" 
     mode_="delimited" > 
        [1010data_QUERY]
    </do>
</dynamic>

Attributes for action_="savefile"

filename_
Accepts a text value that specifies a valid 1010data file name.

The file name must begin with a letter and can only contain numbers, letters, and underscores. It cannot contain any spaces or other special characters.

sep_
Accepts a single character to use as the delimiter between fields (columns).

If this attribute is omitted or blank, a comma (,) is used as the default.

recsep_
Accepts a one- or two-character text value that defines the delimiter to use between records (rows).
Note: To specify a control character, enclose it within curly braces (e.g., {'\t'}).

If this attribute is omitted or blank, a newline (\n) is used as the default.

eof_
Specifies whether or not to omit the record separator at the end of the file. Accepts a 1 or 0.

When eof_="1", the record separator is included at the end of the file.

When eof_="0", the record separator is omitted from the end of the file.

The default is 1.

formatted_
Specifies whether to write data formatted according to the column format or as raw data. Accepts a 1 or 0.

When formatted_="1", the written data is formatted according to the column format.

When formatted_="0", the raw data is written.

The default is 0.

names_
Specifies whether or not to include a header line with column names. Accepts a 1 or 0.

When names_="1", a header line with column names is included.

When names_="0", a header line with column names is not included.

The default is 0.

labels_
Specifies whether or not to include a header line with column labels. Accepts a 1 or 0.

When labels_="1", a header line with column labels is included.

When labels_="0", a header line with column labels is not included.

The default is 0.

value_
The dynamic variable associated with the value_ attribute is set to a package containing information about the saved file.
The package contains the following keys:
estsize
Estimated size of the saved file.
nameok
Flag that indicates whether the file name specified to the checkname_ attribute is a valid file name (i.e., does not contain prohibited characters and is not the name of a subdirectory).

If the file name specified by the checkname_ attribute is a valid file name, this flag is set to 1. Otherwise, it is set to 0.

exists
Flag that indicates whether the file specified by the checkname_ attribute already exists in the user's FTP account.

If the file already exists in the user's FTP account, this flag is set to 1. Otherwise, it is set to 0.

The variable must be declared as a package in the opening <dynamic> tag of the QuickApp (e.g., <dynamic var_name="{pkg(;)}">).

checkname_
Accepts a text value that specifies a valid 1010data file name.

The file name must begin with a letter and can only contain numbers, letters, and underscores. It cannot contain any spaces or other special characters.

mode_
This attribute is optional and is reserved for future use.

Currently, the only valid value is:

  • delimited