RO CSVI
Use of Group by and Sort by fields
| RO CSVI
Required fields
- CSVI Pro 6.0+
- Joomla 2.5 /3.x
When an export template is created, in the fields tab, there are two options Group by and Sort by fields that can be set. Here we will explain what is the use and how to use them
Group by Fields
Often when we do exporting data from database tables, there is always chance of seeing duplicate rows getting exported. By setting group by fields this can be avoided. Say for example, if we are exporting Virtuemart product and we need unique product name to be exported, simply by setting the product_name field in group by field will do the trick.
Also, grouping will be done in the order of fields added. In this example first grouping will be done using product_name and then with the retrieved result again grouping will be done with the second field, here it is category_id and so on.
Multiple fields can be added/deleted by clicking "+/-" next to each field. Dont forget to save the fields by clciking Save button.
Please note that in case you want to group on a field which you do not want to include in export, add the field to the template, set it to unpublished so the field is not included in export file. After that you can select the field here to group on that field.
Sort by Fields
Not only we can group by data but we can even sort them as required. Sort by will sort string type fields in alphabetical order and by default in number type fields in ascending order. It depends on type of field added for sorting.
For example, in Virtuemart product export template to sort by product_name and product_price simply add the fields as shown. Multiple fields can be added/deleted by clicking "+/-" next to each field
Same like groupby, sorting is also done based on the order of fields added. As per the example here Sorting is first done using product_name field and the result will be again sorted using product_price fields and so on.
Source tab option to Load from computer
| RO CSVI
The option to load import file from user computer. This option of selecting the import file can be seen after selecting the import template from RO CSVI Import page. The selected file content is then shown in Import preview page and thereafter used for import.
Install the example templates for RO CSVI addons
| RO CSVI
Follow these 3 steps to install the example templates for RO CSVI addons. This will give you all the example templates for installed addons. These example templates can be used to test your import and export routines. The example templates can also be used for starting to build your own templates.
CSVI Field Mapper
| RO CSVI
The CSVI Field Mapper helps you to map your fields against CSVI fields. One of the most daunting tasks you have to deal with when setting up a new import is to match your own fields with the CSVI fields. To give you a hand, the CSVI Field Mapper has been created.
What is the Field Mapper?
CSVI Field Mapper is a tool to help you create your template with the correct CSVI fields.
Finding the field Field Mapper
The field mapper is located under Templates.
How does the Field Mapper work?
In short, you upload a small sample of the actual file you want to import and CSVI will read the column headers from this file. CSVI will then present these column headers in a table with a dropdown beside it where you can choose the CSVI field you want to link it to. Once you are done, it can look like this:
When you are done with the mapping of the fields, you can create a template of this by clicking on the Create Template link.
Creating a field map
To create a field map we start by going to Components -> CSVI Pro -> Templates -> Field mapper and you get the field mapper list:
Now click on the New button to create a new field map and you get the new screen:
Now the form needs to be filled out:
Name
Give your field map a name
File
Select the file on your computer that you want to map. Take these points into consideration:
- The first line of the field must contain the field names
- The file cannot have Mac line-endings
- Don't upload your full file if it is a large file. We are only using the first line of the file.
Autodetect delimiters
CSVI will try to detect the delimiters used in your CSV file. In case this doesn't work correctly, you can set this to No and specify your own delimiters.
Field delimiter
The field delimiter is the character that separates the fields in your CSV file.
Text enclosure
The text enclosure is the character that surrounds each field.
Action
Select whether you want to do an import or export.
Component
Select for which component you want to do the import/export.
Operation
Select what kind of operation you want to perform.
After these fields are filled out, click on Save. This will create the field map and process your file.
Mapping the fields
After the field map has been saved you can see a table like the screenshot. On the left you see the field names from your file and on the right the available field names of CSVI. CSVI does not match the fields automatically, you will have to choose which fields it belongs to. In the screenshot you can see that the field sku has been linked to the product_sku field, the field picture has been linked to file_url and so on.
Do the same for your fields and click on Save & Close, this brings you back to the field map list.
Create a template
With your field map ready, you can now create a template by clicking on the Create template link in the Template column.
This will create a new template based on your field map settings that you can then use for import.
Final steps
- Go to Templates -> Templates
- Click on the name of the template to edit the template
- On the File tab set the option Use file for configuration to No
- Save the template
You can now use this template for an import.
How to load a patch file?
| RO CSVI
To load a patch file take the following steps:
- Go to Components -> RO CSVI -> Maintenance
- Select RO CSVI
- Select Load patch file, you now see this screen:
- Click on Browse and select the patch file provided to you by the forum
- Click on Continue
- Your patch file has now been loaded