How to group by first X letters of a column value?

Hello

I have a grid with a column with a certain code as the value, e.g. AA04B3, AAB789, B01A02 etc.
I would like to group the grid by the first four letters of that column value, how can I do that?

Thanks, 
Skorri

3 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team August 6, 2020 09:07 AM UTC

Hi Skorri, 
 
Greetings from Syncfusion support. 
 
We checked your query and would like to let you know that the Grid grouping is performed by using the whole column’s data source value which will be sorted in ascending order(by default) if no sorting has been applied for that column and if sorting is applied before grouping, then the same sorting order will be maintained in the group. This is the default behavior of the Grid’s grouping functionality. However you can customize the group text as needed by using the groupSettings captionTemplate. More details on this can be checked in the below help documentation link, 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 


Marked as answer

SJ Skorri Júlíusson August 6, 2020 09:14 AM UTC

Hello,

It is not merely the text that I want to change but the group it self, so the first group would include rows with AABB67, AABB4E, AABB23, the next group would include A0B02C, A0B0E7 etc. That is the rows would be grouped by the first four letters of the code, rather than a separate group for each different 7 letter code. 


SK Sujith Kumar Rajkumar Syncfusion Team August 7, 2020 10:42 AM UTC

Hi Skorri, 

As mentioned in our previous update, the Grid grouping is performed by default using the whole column’s data source value so it is not feasible to perform the mentioned operation. If you need to group based on the first four letters alone then we suggest you to define a separate column with values as the first four letters of the required column and then you can group based on that column to achieve your requirement. 

Let us know if you have any concerns. 

Regards, 
Sujith R 


Loader.
Up arrow icon