hartmut Posted January 17, 2008 Posted January 17, 2008 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
Fitch Posted January 17, 2008 Posted January 17, 2008 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) )
hartmut Posted January 17, 2008 Author Posted January 17, 2008 Thank you very much Works like a charm what a valuable piece of filemaker scripting Best to you Dave
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now