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.

Recursive CF help please

Featured Replies

I'm looking to build a recursive cf that generates a non repeating value list of positive integers within the upper limit and the quantity of items in the list specified at run time.

for example the user enters 12 into a global field (ceiling) and 5 into a global field (qty). The cf should return a list of 5 random, non repeating, numbers in the range of 1 thru 12..

1, 2, 4, 7, 12 ....good

1, 1, 2, 6, 9 ... no good because of the repeating 1

0, 6, 8, 9 11 .. no good because of the 0

3, 9, 10, 11, 13 ... no good because of the 13

4, 5, 6, .. no good because their are only 3 numbers

-3, 4, 5, 8, 10... no good because of the -3

you get the picture.

I've been trying to wrap my left brain around this for a while now and cant seem to get it.

TIA

Help me Obi Wan.. your my only hope

Heres a start; YOu can tweak to build a list using List Function and add a third param for qty

http://sixfriedrice.com/wp/creating-random-numbers-in-filemaker-pro/

; ia

Try:

UniqueSet ( limit ; setSize ) =

Case (

setSize > limit ; "error" ;



Let ( [

item = Int ( Random * limit ) + 1 ;

cache =  List ( item ; Case ( setSize > 1 ; UniqueSet ( limit ; setSize - 1 ) ) )

] ;

Case (

ValueCount ( FilterValues ( cache ; item ) ) > 1 ; UniqueSet ( limit ; setSize ) ;

cache

)

)



)

  • Author

Solved.. thanks Comment

EYOUZZA!!! :wink3:

Try:

UniqueSet ( limit ; setSize ) =

When you give everyone the answer, no one learns anything! .. I know it usually just drags out the entire conversation usually huH!.

Happy Tax days!!!

-i

Edited by Lee Smith
Please don't quote the whole post if you aren't making in line comment.

imoree, what? We're here to give answers.

  • Author

When you give everyone the answer, no one learns anything! .. I know it usually just drags out the entire conversation usually huH!.

Happy Tax days!!!

-i

Imoree..

In my case I learned alot from the solution... might take me a while but probably could write a recursive CF of my own... so speak for yourself, not for me : )

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.