sFile | (String) The file name with the path for loading the data. File must not have the "ini" or "csv" extension, the file type is determined by the filetype parameter.
If a full path is not entered, then it is completed relative to the application folder. It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files or folders. |
---|---|
sParams | (String) Additional parameters that define the way of loading from the file. Entries are in the KeyVal format, for example "filetype:ini;fmt:trans;rowname:boiler;".
"filetype:xxx;" (mandatory) - Specifies the type of the file specified in the sFile parameter
csv - type is a CSV file. It is the multilined file of text values, for example, separated by semicolon. It is commonly used, for example, in the MsExcel program. "fmt:xxx;" (optional) - Specifies the format of stored data in the file.
The default value is "fmt:standard;". The following formats are possible: standard - The meaning depends on the file type:
csv - Values from rows of the CSV file are stored into corresponding rows in the table
ini - Sections of the INI file are the names of rows and keys of the INI file are the column names of the table. Example:
[r0] colname1=boiler1 colname2=boiler2 [r1] colname1=12 colname2=15 trans - Sections of the INI file are the column names of the table and keys of the INI file are the names of rows. Example:
[colname1] r0=boiler1 r1=12 [colname2] r0=boiler2 r1=15 "rowname:xxx;" (optional) - (only for INI) Specifies the name of the row.
If not set, then the "rowname:r;" value is presumed. The name of the row is created by this text amended by the row index, for example if it is the "rowname:rrr;", then the names of rows are "rrr0", "rrr1", etc. "colnameheader:xxx;" (optional) - (only for CSV)
no (default) - in the first row of the file there are stored the data.
yes - in the first row of the file there aren't any data but names of columns. "delimiter:xxx;" (optional) - (only for CSV) The separator of values in the CSV file. The allowed values are:
semicolon (default) - the separator is a semicolon.
comma - the separator is a comma.
space - the separator is a space.
tab - the separator is a tab.
number - i.e. the separator is defined as a number of the ASCII character (in decimal), for example "delimiter:124;" means the "|" separator (vertical bar). "date.fmt:xxx;" (optional) - Date/time format. The allowed values are:
system (default) - the date/time format is set by Windows OS settings (e.g. 22.11.2010 16:30:15).
pm - PROMOTIC date/time format with 1 second precision (e.g. 2010.11.22 16:30:15).
pmmili - PROMOTIC date/time format - precision 10 ms (e.g. 2010.11.22 16:30:15.250).
real - data type of date/time format Date as a real number (e.g. 41392.123456789). "real.dsep:xxx;" (optional) - (only for CSV) The format of decimal separator for real numbers. The allowed values are:
system (default) - the decimal separator is defined by Windows OS settings (e.g. 3,14).
dot - the decimal separator is a dot (independently on Windows OS setting) (e.g. 3.14).
comma - the decimal separator is a comma (independently on Windows OS setting) (e.g. 3,14). "lastcolsep:xxx;" (optional)
yes - On writing, the separator is added after the last value on the row, when reading, the empty value at the end of each row is ignored. From the CSV file standard point of view, this is not correct.
no (default) - The separators are present only between values on the same row, not at the end. From the CSV file standard point of view, this is correct. |
var oDataTable = pMe.Pm("/DataTable");
oDataTable.LoadFromFile("#app:CfgData.csv", "filetype:csv;colnameheader:no;delimiter:semicolon;real.dsep:dot;date.fmt:pm;");
var oDataTable = pMe.Pm("/DataTable");
oDataTable.LoadFromFile("#app:CfgData.ini", "filetype:ini;rowname:boiler;");