Use of Group by and Sort by fields

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.


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.