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.

Random Child Records

Featured Replies

Hi guys,

I want have a portal with 5 random child records in it. Nothing to fancy, I've come up with a couple ideas on how to do it, but niether really give me that warm fuzzy feeling:

1. Sort the portal on a value list. The value list will a field with randon data in it. Then have the portal only show 5 records. Not sure if that will work nice or not.

2. Have a field in the child records have a random field and sort the portal on it. Again showing 5 records only. The problem is the random field needs to be generated on every record all the time.

Anyone got a better way(s)?

How often do you wish to randomize?

  • Author

I'm aiming for daily.

thanks

A calculation like:

GetNthRecord ( Child::ChildID ; Ceiling ( Random * Count ( Child::ChildID ) ) )

could pick a random ChildID for a key field in the Parent. The problems are that (a) being an unstored calculation, it would revaluate on every scren refresh, and (:) you need 5 UNIQUE ID's. I think I would populate the key field by a script:

Set Field [ Parent::ScriptedKey; "" ]

Loop

Exit Loop If [ ValueCount ( Parent::ScriptedKey ) ≥ 5 ]

Set Field [ Parent::ScriptedKey; Let ( item = GetNthRecord ( Child::ChildID ; Ceiling ( Random * Count ( Child::ChildID ) ) ) ; Parent::ScriptedKey & Case ( IsEmpty ( FilterValues ( item ; Parent::ScriptedKey ) ) ; item & ¶ ) ) ]

End Loop

  • Author

thanks! I'll try something like that.

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.