rivet Posted April 16, 2003 Share Posted April 16, 2003 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. Link to comment Share on other sites More sharing options...
RodinBangkok Posted April 16, 2003 Share Posted April 16, 2003 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 Link to comment Share on other sites More sharing options...
danjacoby Posted April 16, 2003 Share Posted April 16, 2003 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. Link to comment Share on other sites More sharing options...
rivet Posted April 21, 2003 Author Share Posted April 21, 2003 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. Link to comment Share on other sites More sharing options...
danjacoby Posted April 21, 2003 Share Posted April 21, 2003 Actually, with 26 people, you're screwed with 5 groups as well. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7839 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now