Script to Group By and Count

I have a view that is grouped by a single select field called Program Name. In this view I can see a count of records per Program Name. How can I create a script to give me a count of records grouped by program name?

Ultimately I want to create an automation that will email me a summary of records by Program Name. I cannot do a linked field as the Program Name is a single select field chosen by a form.

Are you interested in learning how to write scripts yourself, or are you looking to hire a developer to write something for you?

That’s not necessarily true. You could change the {Program Name} field to be a link to another table, something like [Programs]. The link field would work just as well in a form as a single-select field does, and it would make the total count slightly easier to retrieve via a script than tallying single-select entries.

1 Like

I agree with Justin here. You can use a linked record field in the form. However, if you really need the look-and-feel of the single select (e.g. colors and/or the ability to be displayed as radio buttons), you can keep the single select in your form, and use an automation to copy the {Program Name} from the single-select to the linked record field.

If you use a linked record field, you do not need a script at all. You can use count and/or rollup fields to get the number of records per program name. Your automation can use a “Find Records” action to find all the records in the table of program names, and then email the resulting table (including the totals from the count/rollup fields).

2 Likes

Amazing! Don’t know why I didn’t think of that. You guys are awesome. Thank you for solving my problem :grin:

How would the automation look like to copy Program Name from single select to the Linked record field?

Use an Update record action.

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.