Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

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

Posted

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)

    )

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