April 16, 200322 yr I have a list of names that can vary. I have to spread them equally into six groups, where group six would have a minimum of two, or a maximum of the other groups. So.. groups one to five will be equal size, and group six will handle the carry over.
April 16, 200322 yr Rivet, try script below, you will need 3 global numbers and one number field in your db to hold the group number (GrpNo), RecCnt,RecCounter, and CurGrp are global numbers. This works on found set. SetGroup: If [ Mod(Status(CurrentRecordCount), 6) = 0 ] Set Field [ RecCnt, Status(CurrentRecordCount) / 6 ] Else Set Field [ RecCnt, Int(Status(CurrentRecordCount) / 6)+1 ] End If Set Field [ RecCounter, RecCnt ] Set Field [ CurGrp, 1 ] Go to Record/Request/Page [ First ] Loop Set Field [ GrpNo, CurGrp ] Set Field [ RecCounter, RecCounter - 1 ] If [ RecCounter = 0 ] Set Field [ RecCounter, RecCnt ] Set Field [ CurGrp, CurGrp + 1 ] End If Go to Record/Request/Page [ Next, Exit after last ] End Loop
April 16, 200322 yr If you have 26 people, you can't meet your standards: Groups 1-5 are equal, Group 6 has minimum of 2, maximum of number in other groups. 5x5 = 25, leaving 1 for group six. 5x4 = 20, leaving 6 for group six. You'll have to change your standards.
April 21, 200322 yr Author your rigtht, then I have to figure a way so that if the is a single name left over reduce the number of groups by one.
Create an account or sign in to comment