Jump to content
Server Maintenance This Week. ×

How do I make random record selections in FMP5


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

Recommended Posts

  • Newbies

I am designing a database in FileMaker pro ver 5 and need help with the following. I want to be able to select records over a periods of time, in a random fashion. For example, one field in the record is a color. There are 4 colors, with each color having a different frequency of selection. Red might be weekly, on average over a 6 month time. Blue needs to be randomly selected on average once every 2 weeks, and so on. I also need to be able to restrict the selection to monday - friday, and exlude dates based on a list of holidays.

My talents lay outside programming, but hope to give this a good try.

Please copy any responses to [email protected]

Thanks for any assistance offered.

Doug

Link to comment
Share on other sites

The hard part here is the period of time. It all depends on what you mean by "over a 6 month time". You can assign colors based upon a percentage of the number of records by using a random number. You'll have to explain how you are entering records (i.e. how often records are entered)to put in the time element.

Say you wanted Red for 10% of the records, Blue for 20%, Green for 30% and Yellow for 40% (it has to add to 100%). First give each record a random number, say upon creation:

Rand# (calculation) = Random

Next pick a color based upon the distribution of the random number (the function gives numbers from zero to one.

Color (calculation, container) =

Case(

Int(Rand# * 100) <= 10, Color = gRed,

Int(Rand# * 100) <= 30, Color = gBlue,

Int(Rand# * 100) <= 60, Color = gGreen,

Int(Rand# * 100) <= 100, Color = gYellow,

"")

This show you all the steps, actually

Case(

Int(Rand# * 100) <= 10, Color = gRed,

Int(Rand# * 100) <= 30, Color = gBlue,

Int(Rand# * 100) <= 60, Color = gGreen,

gYellow)

will work just fine. These calculations work because the tests happen in order until one succeeds, then the calculation exits. The first part creates a random integer between 0 and 100, the second part picks red for numbers from 0 to 10, green for 11 to 30, blue for 31 to 60, and yellow for 61 to 100. -bd

Link to comment
Share on other sites

This topic is 8613 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.