Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7887 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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.

Posted

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.

This topic is 7887 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.