Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6377 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted (edited)

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
Posted

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.

Posted (edited)

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

This topic is 6377 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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