October 9, 200025 yr 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
October 10, 200025 yr 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
Create an account or sign in to comment