Search these areas:
Help
Support Forums
Product Info



Introduction
DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
Views
Templates
Components
Data Analysis
Members
Security
Importing
Exporting
FTP
JavaScript
Object Model
JavaScript Objects
General Scripting Objects
Data Access Objects
-cmdDelete Object
-cmdInsert Object
-cmdSelect Object
-cmdUpdate Object
-Data Access Method Arguments
-Field Object
-Fields Collection
-Index Object
-Indexes Collection
-previous Object
-record Object
-Resultset Object
-Table Object
-Tables Collection
-TextImporter Object
loadTextFile
loadText
set
get
guessTypes
createTable
appendTable
-Settings Object
-View Object
-Web Object
File Access Objects
Http Client Objects
Security and Membership Objects
Document Object Model (DOM)
Error Descriptions
Object Model Extensions
Full-Text Search
Domain and Email Hosting
HotBlock Modules
Account Management
Glossary
New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

TextImporter Object
The TextImporter object represents text data to be imported into a DataWeb application. Use the TextImporter object to import data from CSV (comma separated value) files, Excel files, and files with other data formats.

Constructor

TextImporter() Creates a new instance of a TextImporter object.

Instance Properties

fields The fields property is an array of objects representing the fields in the source document. Each member of the array has three properties: name, import, and type. The name property gives the name of the field, the import property indicates whether or not to import the field from the source file, and type gives the data type of the field (e.g., "Text", "True/False", etc.).
Warnings Check the value of this property for any warnings concerning the data within the TextImporter object after calling loadTextFile() or loadText().
Errors Check the value of this property for any errors concerning the data within the TextImporter object after calling loadTextFile() or loadText().

Instance Methods

loadTextFile Reads data from a file in the web application and loads it into the calling TextImporter object.
loadText Parses data according to specified parameters and loads it into the calling TextImporter object.
set Modifies data in a TextImporter object.
get Retrieves data from the calling TextImporter object.
guessTypes Fills in the values of the fields array based on a best guess about the kind of data contained in the source document.
createTable Creates a data table based on a TextImporter object.
appendTable Adds data from a TextImporter object to a data table.


Example

/*
* Assume a csv file named "tiTest.csv" (located at the root directory of a web 
* application) whose first row indicates four fields:
* FirstName, LastName, Email, Address
*/

var ti = new TextImporter();
ti.loadTextFile("/tiTest.csv", TRUE, "csv");
for(var prop in ti)
    response.write(prop, "<br>");
response.write("--------<br>");
for(var prop in ti.fields)
    response.write(ti.fields[prop].name, ",", ti.fields[prop].type, "<br>");

/*
* output:
* 
* fields
* Errors
* Warnings
* --------
* FirstName,Text
* LastName,Text
* Email,Text
* Address,Text
* 
*/
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us