====== Property - Import data from CSV ======
This LRT can be used to import property.
==== Prepare CSV file ====
Here is an example of CSV file which can be used for importing property.
name;code;description;setCode;serialNumber;disabled
Skoda Octavia 1;octavia_1;Broken seats;Cars;1234567gdfh-dfgdfg46;false
Skoda Octavia 2;octavia_2;Ordered;Cars;;true
The names of the columns are fixed and you cannot change them.
Overview of attributes:
* 'name' is the descriptive name of the property - must not be null
* 'code' is the technical name of the property, must be unique - must not be null
* 'description' is only a descriptive attribute
* 'setCode' is the code of the set to which the property belongs - must not be null
* 'serialNumber' is only a descriptive attribute
* 'disabled' is an attribute which when true will prevent the property to be assigned to a user - must not be null
There is possibility to import property EAVs too along with basic attributes. To do it, CSV file will look like this:
name;code;description;setCode;serialNumber;disabled;eavName1;eavValue1;eavName2;eavValue2
Skoda Octavia 1;octavia_1;Broken seats;Cars;1234567gdfh-dfgdfg46;false;color;blue;price;300000
Skoda Octavia 2;octavia_2;Ordered;Cars;;truel;color;black;price;500000
For each EAV two new columns are needed, one for EAV code and one for its value. In this case, EAVs "color" and "price" will be imported. Names of these new columns consist of name/value prefix (which is defined in LRT parameters) and order of EAV (In order for all EAVs to be loaded correctly, the order sequence must form a continuous series starting from one (1, 2, 3...)).
CzechIdM uses by default utf-8 encoding. If your input file is encoded in different encoding, or if you experience some issues with non English characters, you may set different encoding in configuration of import long running task. Examples of other used encodings might be windows-1250, or windows-1252
Update is not supported. Only new property can be created by import.
==== Create new LongRunningTask ====
Now we will create the new LongRunningTask (LRT). Go to Settings → Task scheduler → Scheduled tasks and hit green "Add" button to add new LRT.
==== Fill all attributes ====
Now we need to create new LRT with these attributes:
{{.:property_import.png?nolink&604x520}}
Select task type **Import property**, drop CSV file into "Upload a CSV file" dropzone (or click on it to select file from dialog), set column separator and file encoding according to your CSV file. In case you want to import EAVs too, define eav name/value prefix.
==== Run the task ====
Now we just need to hit run.
{{:tutorial:adm:aaaaaaaa6.png?100|}}
Once the task is finished, the property will be imported.