Group by first word of a field

Hi Support,

I have field where I need to group by the first word of the various lines.

Line 1: Voice - Federal Regulatory Assessment Fee
Line 2: Voice - Federal Universal Service Fund
Line 3: Workspace - Google Workspace Enterprise Standard - Commitment - 6252721784-04 - 3/1/2025 - 3/31/2025
Line 4: Workspace - Google Workspace Frontline Standard - Commitment - 6257751899-02 - 3/1/2025 - 3/31/2025

Line 1 and 2 needs to be grouped under Voice.
Line 3 and 4 needs to be grouped under Workspace - Commitment - 3/1/2025 - 3/31/2025

There are more lines on the attached template - this is just to explain the requirement.

Thank you.

Google Workspace & Voice FTI.docx (66.4 KB)
WLPGoogleFreeTextInvoice.Report (11).ddsp (128.8 KB)

Hello Nicky, thank you for your question.
To achieve what you want, you will need to group the data.

Mark lines 1 and 2 and group them by changing the Group by value to:

substring-before(@Name, ’ -')

Since lines 3 and 4 should be grouped differently, group that data using the following Group by expression:

concat(
substring-before(@Name, ’ - Google’),
’ - Commitment - ',
substring-after(substring-after(@Name, ’ - Commitment - '), ’ - '))

Please check and let me know if this works correctly for you.
I’m also sending you a video that explains how grouping and sum definition works, in case you get an unexpected result.

Let me know if you managed to solve the issue.

Hi, we’re revisiting this.

The ask changed to list all lines where WLPFreeTextHeaderTmp/WLPFreeTextTmp/@Name contains the words “Voice” and “Workspace” separately, each with subtotals. So assuming this will be two separate tables, I used a list with an iif function to only display the “Voice” lines. This however doesn’t work well with the Quantity or Amount fields as it’s picked up as a string and not a number. Is there a different way to separate the lines based on what the field starts with?

I attached a more recent ddsp and template.

WLPFreeTextInvoiceGC.Report (21).ddsp (256.1 KB)

Google Workspace & Voice FTI edit.docx (73.3 KB)

Hi Vicky,

I modified the template to meet your requirements. I applied three tables where I used List tagging element and filtered the content to just get the values I want. The first list only shows names which start with “Voice”, the second list only shows names which start with “Workspace” and the third list shows everything else. I applied conditional logic on each of the list, so it only shows if it contains some data.

The trick is in the filter (see the part, marked with orange rectangle above). The same filter is applied in the If tagging element and in SummaryField tagging element, which calculates the LineAmount sum of the filtered records.

Regards,
Albin

Google Workspace & Voice FTI (edited by Docentric).docx (75.9 KB)

Ah. I didn’t use the filter on the list, I only tried on the fields. Ok, I understand what you did. Thank you for the help.

1 Like