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

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

Recommended Posts

Posted

Hello, all. My wife is an elementary school teacher, and she's asked me to create a way for her to generate "bingo cards" with varying contents. That is to say, she'd like to replace the numbers on a traditional bingo card with vocabulary words, simple math equations, etc. So I created a simple file that has a "card printout" layout and a simple data entry layout with 25 fields (b1, b2, b3. . etc. . . i1, i2, i3. . .etc), for the 5 across and 5 down on the printed result. Now for the tricky part (for me at least).

She'd like to be able to print a selected number of cards, each with a different arrangement of the entered data. For example, let's say she enters "flower," "daisy," "ambulance," "recliner" and "telephone" for fields b1, b2, b3, b4 and b5 respectively. The arrangement of these fields (the "B" column) on the first card printed may be as listed above, but perhaps "daisy," "ambulance," "flower," "recliner" and "telephone" on the second card printed, etc. Yes, I know I can just make several printout layouts, each with a different arrangement of these fields, and just have the print routine move from one to the other, printing each, but that seems a rather inelegant way to get the job done. Is it possible to create this type of randomization in FM? Thanks in advance.

Posted

panache,

An ugly way to do this is...

- create 5 global fields with 10 repetitions each. (gB, gI, gN, gG, gO)

- create a Fill Card script

Freeze Window

Go to Record/Request/Page [First]

Loop

[color:"white"]__Set Field ["B1", GetRepetition( gB, Middle( Random,3,1)+1 )"]

[color:"white"]__Loop

[color:"white"]____Set Field ["B2", GetRepetition( gB, Middle( Random,3,1)+1 )"]

[color:"white"]____Exit Loop If ["B1 <> B2"]

[color:"white"]__End Loop

[color:"white"]__Loop

[color:"white"]____Set Field ["B3", GetRepetition( gB, Middle( Random,3,1)+1 )"]

[color:"white"]____Exit Loop If ["B1 <> B3 and B2 <> B3"]

[color:"white"]__End Loop

[color:"white"]__etc...etc...etc...

[color:"white"]__Go to Record/Request/Page [Exit after last, Next]

End Loop

Posted

Mark: Thanks. One question: I don't fully understand the GetRepitition or exit loop statements. Does that look at the middle repetition of global field gB? I've never seen "random" before, and the FM Help just said it generates a random number. Sorry, but can you explain it to me?

Also, exit if B1 is greater than or less than B2? Forgive my ignorance, I know I'm a pain.

Posted

panache,

The GetRepetition [ ] syntax is

GetRepetition [ Repeating Field , Number ]

eg GetRepetion [ gB , 3 ] will return the value of the third repetion in the repeating field gB.

The Middle( ) syntax is

Middle( Text , Start , Size )

eg Middle( "panache" , 3 , 1 ) will return "n" because "n" is the third letter and only one character begining at the third position is requested.

Random creates a random number between 0 and 1.

I used the Random function to return a random value (eg .345). Now with a number, I used Middle( Random,3,1)+1) to extract the 5 (added 1 to prevent 0 and/or return a 10). This number (6) is used to select a repetion in the repeating global field.

So, Set Field ["B2", GetRepetition( gB, Middle( Random,3,1)+1 )"] entered the sixth repetion of gB into the field B2.

The Exit Loop If ["B1 <> B2"] is a test to ensure that the values are unique on each card. If you leave out the Loop/Exit Loop If, the values of B1 and B2 could be equal on the same card. (The exit loop also prevets an endless loop.)

eg First field-loop 1, Random = .345; second field-loop 1, Random =.715, second field-loop 2, Random = .924.

Now a better way to do this and the way of your original request with five variable values and five returned values is...

replace the Middle( ) functions with Round( Random * ( b - a ) + a , 0 )

a = minimum range

b = maximun range

eg Set Field ["B3", GetRepetition( gB, Round( Random * ( 5 - 1 ) + 1 , 0 )"]

This will allow you to create cards from any number of variables.

I hope that someone else has a cleaner way, but I know this works.

P.S. Do not forget. C3 is the Free Space.

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