EspressChart also allows you to retrieve data from flat text files. To add a text file as a data source, select the TXTFiles node in the Data Source Manager and click the button. A dialog will open prompting you to specify a display name and the location of the text file you want to use.
Tip | |
---|---|
The text file can be also retrieved from URL. To do so, enter the URL to the File text field. You have to enter a full URL with protocol etc. (e.g. |
After you specify the information, click the TXTFiles node of the Data Source Manager window.
button and the text source will appear under theThere are certain formatting requirements for the data within a text file in order make it readable by EspressChart. Generally, data is expected to be in a form similar to the following:
String,date,decimal Name,day,Volume "John","1997-10-3",32.3 "John","1997-4-3",20.2 "Mary","1997-9-3",10.2 "Mary","1997-10-04",18.6
The above data file is a plain text file. The first row specifies the data types and the second row specifies the field names. The third row and so on are the records. Every text file must consist of these three parts. There are four records, with three fields each in the example data file. The delimiter between the fields may be one of the following characters: ","
, ";"
, or " "
(that is comma, semi-colon, or space). Each field can be put in quotes (single or double).
In text data files, the data type is specified using a keyword. The following is a list of recognized keywords and their corresponding JDBC type and Java type.
Data File Keywords (Not Case Sensitive) | JDBC Type | Java Type in EspressChart |
---|---|---|
Boolean, logical, bit | BIT | Boolean |
tinyint | TINYINT | byte |
smallint, short | SMALLINT | short |
int, integer | INTEGER | int |
long, bigint | BIGINT | long |
float | FLOAT | double |
real | REAL | float |
double | DOUBLE | double |
numeric | NUMERIC | java.math.BigDecimal |
decimal | DECIMAL | java.math.BigDecimal |
date | DATE | java.sql.Date |
time | TIME | java.sql.Time |
timestamp | TIMESTAMP | java.sql.Timestamp |
string | CHAR | String |
varchar | VARCHAR | String |
longvarchar | LONGVARCHAR | String |
For certain data types, the data in a text file must be presented in a specific format. The following is a list of the data types that require specific formatting:
Data Type | Format | Example |
---|---|---|
Date | yyyy-mm-dd or yyyy-mm | 2001-06-12 or 2000-06 |
Time | hh:mm:ss | 12:17:34 |
Timestamp | yyyy-mm-dd hh:mm:ss | 2001-06-12 12:17:34 |
Boolean | true/false, t/f, 1/0 (case insensitive) | true |
There is a sample text file included in the EspressChart installation. The file is located in help/examples/DataSources/text
directory of your installation and is called Sample.dat
.