cancel
Showing results for 
Search instead for 
Did you mean: 

How to group duplicates (by one column name) in a collection, but require values from all columns in the collection

AnshulBhatia
Level 2
Need advice on how to arrive at this : Collection1(INPUT) - RollNo, StudentName, Subject, Marks //Collection1(input) has about 1000 records 1,ABC,English, 50 1,ABC,Math,60 2,XYZ, English, 60 I want identify all the duplicates by RollNo into another collection with ALL COLUMN values Output(Collection2) 1,ABC,English,50 1,ABC,Math,60 I will pass this collection onto a loop,I will be working on one set of duplicates, at a time
3 REPLIES 3

Denis__Dennehy
Level 15
Maybe sort the collection by roll number (there is an action for this in the utility collection VBO) and then loop through it saving all items into a seperate collection as I go until the roll number changes - then do what you need to do - then continue looping storing the items with the next roll number.

Yes, I have sorted the collection. How do I stop until I see a new roll number? anyway for me to ""get next item and then check if previous value of roll no equals current value"" (if this bit I can get some advice), then I know how to proceed , if so, then add row to collection, else stop

Anonymous
Not applicable
17.3999939 -69 1.25 0 -240 60 30 8eef32ed-71b2-49df-81af-f6819b16b398 -405 -225 150 90 -135 -255 60 30 collection 135 -255 60 30 collection 0 -180 60 30 f33ad002-f6d2-43d4-a952-502ab26678b4 0 225 60 30 0 -90 60 30 a4fb4747-1626-4029-a6b2-ee6fcba48a54 fdf36f83-b910-42ba-9bc1-86fa6ef85122 ForEach Coll1 0 180 60 30 508246f8-1d70-437d-8e16-23bc4554bc86 fdf36f83-b910-42ba-9bc1-86fa6ef85122 0 0 60 30 0baa194c-7b55-484e-86c4-7635345d2ef1 27d4aca3-c61e-4578-91ca-44bb897fa832 ForEach Coll2 0 135 60 30 acf2d001-289e-4ff8-99f4-a5d342b4a436 27d4aca3-c61e-4578-91ca-44bb897fa832 150 -135 60 30 number 225 -135 60 30 number 0 -135 60 30 c5380b2f-e19b-4581-9b99-56845c2d1791 0 45 60 30 443949c4-26c7-4cf5-9247-210462431197 0 -45 60 30 20328f9c-389b-4315-bcfc-7a0163b67b20 90 45 60 30 3aa6acd8-12fb-40eb-81b4-fea6b800b228 90635ce8-37d7-4907-9ff9-534a00edadb5 -90 45 60 30 number 0 180 45 60 30 e0064d3a-d863-4bac-8b53-24209d52d67b 255 45 60 30 d3c82f6c-a05e-4346-8d7a-d77584d5c2c2 79ead67d-ebbe-4fdd-8723-39b68320327a -195 -150 60 30 collection 405 45 60 30 591bc880-e50c-402c-89e6-6cc043c13b9d 0 90 60 30 79ead67d-ebbe-4fdd-8723-39b68320327a 330 45 60 30 ed105fb6-5d91-49ab-bca9-787f19fbdf59 405 135 60 30 79ead67d-ebbe-4fdd-8723-39b68320327a hope this helps 🙂