How Do I Count the Total Number of Similar Values in a Column?


Badge +9

So I need a site workflow to query a list and make a count of column values which are similar. In the example below, there would be 4 instances of 26 and 3 instances of 27. I can then go on and do other things with those numbers. How should this be done?

My ID

26

26

26

26

27

27

27


2 replies

Userlevel 2
Badge +11

For a NW 2013 workflow I would use the following approach:

  • WF variables:
    • colMyIDs
    • colMyIDsCount
    • colItemIDs
    • numIndex
  • WF actions:
    • Get MyIDS in collection colMyIDs
    • Remove duplicates with a Collection Operation action
    • Use a For each to loop through each MyID
      • Get current MyID's index and store in numIndex
      • quey list for all item ids with MyID = current MyID from colMyIDs and store in colItemIDs
      • Count items in collection colItemIDs
      • Add count value to colMyIDsCount using numIndex

Hopefully this is sufficient to get you going.

Badge +9

Thank you. Removing duplicates was also what I was thinking earlier so your post confirms it. Here it is in action:

Reply