ImportOptions class (Pivot)

ImportOptions()

new ImportOptions()

The ImportOptions type defines options to import data from CSV format. The Import() method imports data from CSV format. A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The ImportOptions type can be used to specify the default options for the Import() method, such as whether to clear existing data, how to generate column captions, the format of the source data, and more.

Members

(static) clear :object

The clear field specifies whether previously data of the control is cleared. The clear field can be set to true to clear the control's data before importing new data, or set to false to keep the existing data and append new data to it. The default value of the clear field is true, which means that by default the control's data is cleared before importing new data.
Type:
  • object
Example
false {boolean}, the control's data is not cleared by Import() method, so new data is appended
true {boolean}, the control's data is cleared before import new data
clear

(static) columnCaption :object

The columnCaption field defines an expression that generates captions for new columns. The columnCaption field supports the following keywords:
index, returns the index of the column whose caption need to be generated

The columnCaption field can be set to a string expression that includes the keyword "index" to generate captions based on the column index. For example, setting columnCaption to "`Column ` + (1 + index)" will generate captions such as "Column 1", "Column 2", etc., where the index is 1-based. If columnCaption is set to an empty string, no caption will be provided for new columns. If it is set to a specific string (e.g., "`import`"), all columns will have the same caption.

Type:
  • object
Example
"" {string}, no caption is provided for new columns
"`import`" {string}, all columns are named "import"
"index" {string}, the caption's index (0-based) is the caption of the column
"`Field ` + (1 + index)" {string}, generates captions such as "Field 1", "Field 2", ... where the index (1-based) is displayed after the caption
"`Column <b><off -2>` + (1 + index)" {string}, generates captions such as "Column 1", "Column 2", ... where the index (1-based) is displayed in bold up to the caption
columnCaption

(static) eof :object

The eof (EndOfField) field specifies the character to separate fields within the row/item/line (has effect only if format field is "CSV"). The eof field can be set to a specific character (e.g., "," for comma, "\t" for tab) to indicate the delimiter used to separate fields within a row/item/line. The default value of the eof field is ",", which means that by default fields are separated by a comma character.
Type:
  • object
Example
"\t" {string}, specifies TAB charactar as field separator
"," {string}, specifies comma charactar as field separator
eof

(static) eor :object

The eor (EndOfRow) field specifies the delimiter, which can be a character, string, or regular expression (@since 4.4), used to identify the end of a row, item, or line during parsing (has effect only if format field is "CSV"). The eor field can be set to a string to specify a specific character or sequence of characters as the row/item/line delimiter, or set to a regular expression to match patterns that indicate the end of a row/item/line. The default value of the eor field is "\r\n", which means that by default the end of a row/item/line is identified by the Windows-style newline sequence (carriage return followed by line feed).
Type:
  • object
Example
";" {string}, indicates that the ; (semicolon) character ends each row/item/line
/^[ \t]*\r\n/m {RegExp}, empty lines delimites each item (match blank lines that contain only spaces or tabs, followed by a Windows-style newline \r\n)
eor

(static) format :object

The format field specifies the format of source to import data form. The format field can be set to "CSV" to specify that the source of import is a string in CSV format, or set to null to specify that the source of import is an array of value type. The default value of the format field is null, which means that by default the source of import is an array of value type.
Type:
  • object
Example
null {null}, specifies that the source of import is an array of [[value]] type
"CSV" {string}, specifies that the source of import is a string in CSV format
format

(static) hdr :object

The hdr field specifies whether the first line indicates the control's header (has effect only if format field is "CSV"). The hdr field can be set to true to indicate that the first line of the CSV data represents the control's header, which means that the values in the first line will be used as column captions. If hdr is set to false, the first line will be treated as a regular data row, and default column captions will be generated based on the columnCaption option or other default behavior. The default value of the hdr field is true, which means that by default the first line of CSV data is expected to represent the control's header.
Type:
  • object
Example
false {boolean}, specifies the no header line is provided
true {boolean}, the first line defines the control's header
hdr

(static) ignoreXML :object

The ignoreXML field specifies whether the file is loaded as CSV even for .xml files (files of XML type). The ignoreXML field can be set to true to indicate that the import process should treat the source file as CSV format regardless of its extension, which means that even if the file has a .xml extension, it will be parsed as CSV data. If ignoreXML is set to false, the import process will determine the format based on the file's extension, treating .xml files as XML format and other files as CSV format. The default value of the ignoreXML field is false, which means that by default the import process will recognize .xml files as XML format and other files as CSV format.
Type:
  • object
Example
false {boolean}, indicates that an .xml file is loaded using the LoadXML() method, any other file is loaded as CSV file
true {boolean}, no matter of file's extension the data is loaded as CSV file
ignoreXML

(static) limit :object

The limit field specifies the maximum number of rows/items/lines to import. The limit field can be set to a numeric value to limit the number of rows/items/lines to import, or set to undefined to specify an unlimited number of rows/items/lines to import. The default value of the limit field is undefined, which means that by default there is no limit on the number of rows/items/lines to import.
Type:
  • object
Example
undefined {undefined}, specifies unlimited number of rows/items/lines to import
1000 {number}, limits the items to import to 1,000
limit

(static) parent :object

The parent field defines the parent item the import data goes to. The parent field can be one of the following:
  • parent {number}, indicates a numeric value that defines the index of the parent's item (0-based)
  • parent {string}, specifies a string expression that defines the identifier/key of the parent's item
  • parent {Item}, specifies the object reference to the parent's item
Type:
  • object
Example
0 {number}, the items to import are added as child-items of item with the index 0
parent

(static) str :object

The str field specifies the character to quote values (has effect only if format field is "CSV"). The str field can be set to a specific character (e.g., "\"" for double quotes, "'" for single quotes) to indicate the character used to quote values that contain special characters such as the field delimiter (eof) or the end of row delimiter (eor). The default value of the str field is "\"", which means that by default values are quoted using double quotes.
Type:
  • object
Example
"'" {string}, specifies ' character to quote any value that contains other ' or eof character
"\"" {string}, specifies " character to quote any value that contains other " or eof character
str