Embedded CSV metadata
Embedded metadata is additional records in CSV data that contain instructions on how the data should be parsed. In the metadata, you can specify which delimiter and decimal separator are used in your file, as well as define field types and unique names.
Each metadata record starts with an annotation that defines which configuration is specified in this record.
Note Values in the CSV metadata are overridden by values defined in the mapping or in the server’s schema.
Supported metadata annotations
Annotation | Description |
---|---|
sep | optionalSpecifies which delimiter is used in the file. The following delimiters are supported: "," , ";" , "|" , or "\t" . Supported annotation formats are the following: sep=<value> and "sep=<value>". If the sep is not set, Flexmonster will autodetect the delimiter used in the file. |
#decimalSeparator | optionalSpecifies which character separates decimal parts of numbers in the file. The following decimal separators are supported: "." and "," . |
#dataType | optionalIndicates the record containing field types. If the field types are not specified, they are resolved automatically. Learn more about specifying field types. |
#caption | optionalIndicates the record containing field captions, which will be displayed everywhere in the component’s UI. Learn more about setting field captions. |
How to specify the CSV metadata
Metadata records should be specified before records with data. The order does not matter, except for the sep annotation, which must always go first if defined.
Example:
sep=;
#decimalSeparator=,
#dataType;string;string;string;float
#caption;Category;Color;Country;Price
item_category;item_color;country;item_price
Accessories;red;Australia;174,25
Components;blue;France;768,75
Clothing;green;Canada;512,5