Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Out of Curiosity, Is it possible in a lookup to have a random placement

Featured Replies

By this I mean

 

If I had a sentence.

 

" I love the color  .........."

The relationship word is color

but the possible answers might be

red, blue, green , yellow orange white , maroon.

 

Can this be done somehow?

 

The lookup may have a random answer within a list...

 

Not sure what call this.

 

 

 

 

I'm not absolutely sure what you're trying to do. I think you want to select a random record from another table. If that's the case, here's how I would probably do it. I'm going to work with a Sentences table and a Colors table.

 

Create a cartesian product relationship between the two tables. This relates all of the records in one table to all of the records in the other table. Normally you create a equals relationship where the match fields must equal each other and the symbol in the popup menu between the match field selection lists is an equal sign. For a cartesian product relationship the match fields don't really matter and you select the "x" symbol in the popup menu. See http://help.filemaker.com/app/answers/detail/a_id/5463/~/using-the-cartesian-product-relationship-in-filemaker-profor more information about it.

 

Now that you have the cartesian product relationship, you can create a calculation that will, from Sentences, choose a random record's field's contents in Colors:

Let(
  [
    _count = Count(Colors::id);
    _random = Int( Random * _count ) + 1
  ];

  GetNthRecord( Colors::color; _random )
)

Check out http://sixfriedrice.com/wp/creating-random-numbers-in-filemaker-pro/for a nice custom function that'll do a better job at generating random numbers.

 

Thanks,

Chuck

FYI, FMI have fixed the Random function so that in can no longer return 1. That was waaaaaay back in v10.0v3.

 

Thanks for the information. I was unaware of that.

  • 2 weeks later...
  • Author

I don't quite get it. I made a file with a drop down box and a relationship to see if there is a way to do this with random birds of the same name. If you try to place a bird name you will always get the same lookup.

I am trying to get a random of the same bird, as in the example i am uploading

Can someone help me get this right with this file.

Thanks

 

Birds for FMFORUM RANDOM.fmp12.zip

  • Author

Thank you so much

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.