Data Visualization(report): Group by a substring

Flavio4
Kilo Sage

Hello,

the need is to produce a report/data visualisation, grouping by a substring of the Name of a column.

E.g. list of some Task table records by Group By the first 7 characters of the Service.Name (for example to group all the "ServAAA1", "ServAAA2", "ServAAA3", etc. tasks, in comparison with the group of "ServBBB1", "ServBBB2", etc.

Apart from adding a Calculated Column in the Task table (which might not be a good idea), are there other ways to do it?

Thank you
Flavio

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Flavio4 

OOTB you cannot group by on substring field value

no straight forward way unless you have a custom field on your table.

Did you try to use Report function field?

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Flavio4 

OOTB you cannot group by on substring field value

no straight forward way unless you have a custom field on your table.

Did you try to use Report function field?

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you Ankur.

Unfortunately in our instance the Function Fields function is disabled, because of alleged risks of jeopardizing performance.
I retain that it is not possible in ways other than the Function Fields.

Regards
Flavio

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Flavio4 

 

Grouping by a substring is not possible. Based on the data, the best approach is to use a search condition like starts with ServAAA, which will display only the records that match this prefix. Then you can perform a group by on the field.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Did you try my workaround?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************