Skip to main content
Nintex Community Menu Bar

Count duplicate values in a collection variable and output total of each to their own variable

  • March 19, 2020
  • 3 replies
  • 13 views

Forum|alt.badge.img+1

Thanks in advance.

I have a Sharepoint list which the 'audience' field allows multiple selections for who a class is being held for (i.e. Team A, Team B, Team C, etc.), so a record could have one or more teams selected.

What I am trying to ultimately accomplish is, whenever an item is created or updated, run through the whole list and output a total count of classes (record) that each team is identified in.

For example, I might have

ID   Audience

1    Team A

2    Team A, Team C

3    Team B, Team C

4    Team A, Team B, Team C

5    Team C

 

So, I would want to see is to have a total count updated in their own value in their own record in a different sharepoint list (would use for a graph I am building in Collabion).

i.e.

Team       Count

Team A     3

Team B     2

Team C     4

 

I know I can use a Configure Action - Query List to run through all of the items and put the values into a collection variable, I just don't know how to parse them based on values and count them as groups.

3 replies

Simon Muntz
Nintex Partner
Forum|alt.badge.img+23
  • Nintex Partner
  • March 23, 2020

Hi,

 

I would do it like this:

Query list Action:

To get the Audience from each item wich saves into a collection variable.

 

For Each Action

Goes through the collection one by one.  Each time pulling out the audience for each item

 

Regular expression: (Inside above for Each)

Split all the entries that come out of the for each and put into a collection variable.

 

For Each: (Below Regular expression inside above for each)

Run if action (run if team a)

 

Do calculation (inside run if)

Adds a 1 to a variable if equalls team a

 

Do the same "run if" "do calculation" for each  team required.

 

At the end you will have a variable for each team with an total in it.

 

See attached shell workflow for a visual of above.

 


Forum|alt.badge.img+1
  • Author
  • March 24, 2020
Thanks Simon, unfortunately we are not on O365 so I can't use a .nwp file. Are you able to export as an .nwf, or print as PDF and provide?

Simon Muntz
Nintex Partner
Forum|alt.badge.img+23
  • Nintex Partner
  • March 24, 2020

Sorry about the attachment but you did post in the Nintex for Office 365 section.  I have moved this thread to the Nintex for SharePoint section.

See new attachment for shell workflow.