...
- charset- Optional charset used for reading the csv file. Defaults to ISO-8859-1.
- description - Optional description only used for reference.
- importFile - Path and name of a csv file from the model. This file will be imported.
- displayName - name used to display the import file name in the ModuleRunTableDisplay component.
- table - mapping of column names to displayNames and types that will be used to store into FEWS. If a column isn't mapped the csv column name is used as displayName and String is used as column type. The following types can be mapped using the name attribute to map a csv column name to a displayName:
- stringColumn - set the column type to string.
- booleanColumn - set the column type to boolean. Only the values 'true' and 'false' are allowed.
- integerColumn - set the column type to integer.
- doubleColumn - set the column type to double.
- dateTimeColumn - set the column type to dateTime. In case a date pattern is specified, the string will be parsed according this format. If no format was specified, a timestamp is assumed in milliseconds.
Configuration example:
In the following example one importCsvModuleRunTablesActivity is specified for the import file import_csv_module_test1.csv. In case more than one csv file has to be imported, for each csv file an activity has to be configured. Not that in this example the csv column 'Float' hasn't been mapped. This will result in importing the 'Float' column as a String column into FEWS.
Code Block | ||||
---|---|---|---|---|
| ||||
<importActivities> <importCsvModuleRunTablesActivity> <charset>UTF-8</charset> <description>Csv Module Data Activity Test case.</description> <importFile>import_csv_module_test1.csv</importFile> <displayName>Import CSV Module Test1</displayName> <table> <!-- Map de following CSV definition: DateTime;Status;Boolean;Integer;Float;Double;String 2003-02-22 00:00;Ok;yes;14;1.4;1.45;Hello world 1 2003-02-23 00:00;Not Ok;;true;24;2.4;2.45;Hello world 2 --> <dateTimeColumn name="DateTime" displayName="datum" pattern="yyyy-MM-dd HH:ss"/> <stringColumn name="Status" displayName="status field"/> <booleanColumn name="Boolean" displayName="Yes or No"/> <integerColumn name="Integer" displayName="Int field"/> <doubleColumn name="Double" displayName="Double field"/> <stringColumn name="String" displayName="String field"/> </table> </importCsvModuleRunTablesActivity> </importActivities> |
If errors have been made in the mapping of the csv table, one warning will be logged per column to avoid flooding the log file with warnings. The import will always continue and a missing value will be set. The exceptions are Booleans that will be set to false and dataTimes will be set to 0.
Shutdown Activities
Elements of the Shutdown Activities configuration
This activity is the identical to the startUpActivities. The only difference is that these are carried out after the module run and import of data. See definition of StartUp activities for configuration.