Skip 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.

Need help with the result of a looping script.

Featured Replies

I have a database with a little more than 1 million records where a very simplified version of 1 table looks like this.

Record.....ID_Field....Log_in

1.............1234........1

2.............1234........2

3.............1234........2

4.............1234........4

5.............1234........2

6.............1234........3

7.............1234........4

I need to run a looping script that will look for the highest number in field 2 and then assign it to all of the records in a third field so it looks something like this.

Record.....ID_field....Log_in.....NumLogIn

1.............1234........1..........4

2.............1234........2..........4

3.............1234........2..........4

4.............1234........4..........4

5.............1234........2..........4

6.............1234........3..........4

7.............1234........4..........4

Can anyone help me write this?

Thank you,

Steve

Sort the records by field two, get the value from the first or last record (depending which way you sort it), then simply:

Sort Records[by Field 2, decsending]

Go To Record / Request [First]

Set Variable [ $maxValue ; Table::Field_2 ]

Loop

Set Field[ Table::Field_3 ; $maxValue ]

Go To Record / Request [Next ; Exit After Last]

End Loop

Edited by Guest

... but here's a question - why?

Oh and as a side note, rather than looping, you could probably just use the replace field contents script step which should replace all the contents at once, but the quesiton of why still remains.

As Genx asks, why are you wanting this because looping through a million records is major bummer and I would bet there are better ways to accomplish what you wish ... OR ... something is lacking in your existing structure.

Why not create a self-join relationship based upon Main::ID Field = SelfJoin::ID Field. Then a calculation (number) of Max ( selfJoin:: Log_In) or, if the largest Log_In is always last then Last( selfJoin:: Log_In ) should give you what you wish. Still, I would bet a good structure would eliminate the need for an aggregate calc entirely.

LaRetta

Edited by Guest

Lol yay, 2:30 = bed time. To lazy to give that explanation, yay for LaRetta :

Goodnight, sir! :zzz: :smile2:

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.