- Vytvoril D2000 Dev Team na nov 24, 2022
IMPORT_CSV_TEXT action
IMPORT_CSV_TEXT destStruct, delimiter, inputIdent_Text, timeZone, retCodeIdent_Int[, timeMaskIdent [, lineFrom [, lineTo]]] [TIME]
destStruct | in | Column identifier or identifier of a local variable of the Record type. |
delimiter | in | Identifier of the Text type - delimiter used in a CSV file. |
inputIdent_Text | in | String in CSV format |
timeZone | in | Parameter of the Text, Int or Bool type - defines interpretation of timestamps. |
timeMaskIdent | in | Identifier of the Text type - mask for reading a value of the Absolute time type. |
retCodeIdent | out | Return code of the Int type - action success. |
lineFrom | in | Parameter of the Int type - begin line. |
lineTo | in | Parameter of the Int type - end line. |
TIME | in | Keyword. |
The action success is indicated by the output parameter retCodeIdent_Int. The value of 0 means the successful import, value other than 0 means an error. Depending on the parameter destStruct, the action imports following:
- a whole structure - the parameter is a local structure identifier
- a structure column - the parameter is the reference to a structure column
The CSV string format is described in the action EXPORT_CSV_TEXT.
If the identifier timeMaskIdent is not defined, the function expects the "dd.mm.yyyy hh:mi:ss" format for items containing an absolute time. If the parameter is defined, the format of the time is to be imported according to that mask. In case that the hh, mi or ss time components are missing, they will be automatically replaced with 0.
When real numbers are imported the separator of decimal places may be both "." (dot) and "," (comma) symbols.
When integer and real numbers are imported from CSV the thousand separator is a blank space.
If the value of the parameter timeMaskIdent is "" (empty mask), values of the Absolute time and Real type are to be converted according to the settings in the Regional and Language Options of the current user on Windows systems. For different operating systems the empty mask is automatically replaced by the value of "dd.mm.rrrr hh:mi:ss".
When the item is converted to Absolute time and is an empty string, the action interprets such item as invalid value.
If the keyword TIME is used, there is the assumption, that the occurrence times of values are saved in the CSV (the double number of columns in this CSV string).
In a case of need, the local variable destStruct
will be resized. Its size is given by the number of values in the particular CSV string.
The parameter timeZone defines interpretation of timestamps. In case of empty text, timestamps are interpreted as local times. In case of defined time zone name (e.g. "Europe/London"), timestamps are interpreted as local times for given time zone. In case of integer value, timestamps are interpreted as times with fixed offset from UTC, where given value defines offset in seconds. For historical reasons boolean values are accepted: @FALSE - timestamps are interpreted as local times, @TRUE - timestamps are interpreted as times with fixed offset of 3600 seconds (1 hour) from UTC. Usage of boolean value @TRUE is not recommended and generates warning when ESL script is being saved. It is recommended to replace it with integer value.
If the parameters lineFrom and lineTo are defined, there will be imported all the lines from the line defined by LineFrom up to the line defined by the parameter lineTo. If the value of both the parameters is -1, there will be imported the whole CSV string.
The CSV delimiter (the parameter delimiter) may be obtained by calling the function %GetCSVDelimiter.
IMPORT_CSV destStruct, delimiter, fName, bMonoTimes, retCodeIdent_Int, , lineFrom, lineTo
Related pages:
Pridať komentár