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.

finding random Entry from Value List

Featured Replies

Hello

In a new record calculation where the field is empty and filemaker does a calculation during the making of the new record, I would like it to place the Random of something from a value list named

"Streets" So in the value list it has this as an example

AVE

ST

BLVD

CIRCLE

WAY

LANE

ROAD

I would like the calculation to enter a random from that value list if that is a possibility.

Thanks

The function to start with is:

GetValue(listOfValues;valueNumber)

Specify the listOfValues as your value list with this function:

ValueListItems(fileName;valuelist)

like so:

ValueListItems(Get(FileName);"Streets")

Now we just need the valueNumber parameter, a random number from 1 to the number of values in your list:

1 + Round(Random * (itemCount - 1); 0)

Notice I used itemCount in the formula, which represents the count of values in your Streets list:

ValueCount( ValueListItems(Get(FileName);"Streets") )

Since that uses the same calculation as above, I'd make the calculation more concise with a Let function:

Let(

    [ items = ValueListItems(Get(FileName);"Streets") ; 

      itemCount = ValueCount( items ) ; 

      randItem = 1 + Round(Random * (itemCount - 1); 0) ] ;



      GetValue(items;randItem)

    )

  • Author

Thank you very much

Works like a charm what a valuable piece of filemaker scripting

Best to you

Dave

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.