Helium provides two methods for processing CSV files. Both these method parse the provided files according the the CSV headers provided in the file and the DSL objects that are used to store the result of CSV processing.
The following applies to both methods of processing CSV files:
Currently, only plain CSV files are supported. Native Excel formats etc. are not supported.
CSV files must have a single header line.
In both cases the processing involves parsing a line of the CSV file to a DSL object instance. The following applies in this regard:
Column names for the CSV file must match the attribute names in the destination object. Case is ignored. A column firstname will for example match to attributes named both firstName and firstname.
Parsing is type-safe. For example, an object with a birth_date attribute that is of type date must contain values that can be converted to a date value using the acting user’s preferred Locale and Time Zone.
Complex attributes are supported. For example the CSV file may contain a column header clinic.name This will automatically populate the name attribute of an object that is associated with the primary object through a simple relationship with the name clinic. Simple relationships are one-to-one and many-to-one relationships. Other relationships aren’t supported and will be ignored. The object instance that represents the named relationships will only be created if the value in the column is not null. So if none of the complex attributes access through a specific relationships is set to a non-null value, then that related object won’t be created.
Any unhandled parsing errors will result in the entire transaction being rolled back. Details of the error can be inspected using the Helium logging service.
Standard CSV Processing
The standard CSV processing mechanism involves processing of an entire CSV file at once, resulting in a collection of object instances.
Add Comment