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.

Featured Replies

I have 45 records, and I have a field name "selected number". How can I make a script that can tell me which one got selected first?

Let say my first record came up randomly is 'C', then in the field "selected number" should have number'1' in it. If the second record came up to be 'T', then the field "selected field should have number '2' in it. And so on.

Please help me, I appreciated it.

Not sure exactly without seeing your random script but couldn't you just add a Set Field script step into your random script?

Ed

Hi,

Re-using Dan's awesome Random script and introducing in it a selected and global field g_selected field :

Show All Records

Set field (g_selected, 0)

Loop

SetField(gRandom, "Round(Random* Status(CurrentFoundCount) + .5, 0)")

GoToRecord/Request/Pate ("gRandom")

Set Field (selected, g_selected+1)

Se Field (g_selected, selected)

Omit Record

Exit Loop If (Status(CurrentRecordCount) - Status(CurrentFoundCount) = 15)

End Loop

Show Omitted

Sorry,

I misunderstood, I thought you already had a random script and just wanted to add in the selection number, sorry!

Ed

  • Author

But the field 'selected number' can't be global, it has to be in other format if I want my records to have different numbers for them.

Hi,

You need to look at Ugo's post again

What is happening is there is 1 global field - g_Selected this gets set to 0 at the start of the script

Then in each loop the current record's Selected field is set to g_Selected + 1

The global field is then set to the current record's Selected field ready for the next record...

g_Selected = 0

FIRST LOOP

Current record Selected field = 1 (g_Selected + 1)

g_Selected = 1 (Current records Selected Field)

SECOND LOOP

Current record Selected field = 2 (g_Selected + 1)

g_Selected = 2 (Current records Selected Field)

and so on...

Ed

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.