Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

I am trying to come up with a calculation to incorporate into a script. Basically the calculation has to compare the value of a field in the current record against the value of the same field in the previous record. It seems like there should be a fairly straight forward way to do this, but I'm missing it.

It would be a boolean result. The value is either equal or notequal to the previous value.

Would appreciate some help.

Thanks.

Posted

How would you define the previous record? (It changes based on sort order and found set). In the same table or that last one viewed?

You could capture a value in a variable in a navigation script, compare and set a field.

Can you expand on your goal?

Posted

Assuming that by "previous record"" you mean whatever record happens to be before the current record, in the current found set, according to the current sort order, you can use the GetNthRecord() function:

Valuefield = GetNthRecord ( Valuefield ; Get ( RecordNumber ) - 1 )

If you are in a script, you can also move to the previous record, put the value in a variable and come back to do the comparison.

Posted (edited)

The previous record would be based on an automated unique identifier serial number. So the comparison would always be

(Value of field(x) in record with UI(y)) = (value of field(x) in record with UI(y-1))

This will be incorporated into a rather complex parsing script. I want the script to skip to the next found value if it encounters a consecutive repeat.

Yes I have it set up to work with a navigation script, but I was wondering if there was a less convoluted way since my script is taking on a life of its own. One calculation to activate an exit loop is my goal.

Thanks

Edited by Guest
Posted

This calc looks good. I will give it a try.

I am trying to avoid additional script steps, so I would prefer not using go to previous record, but that would work as well as you suggested.

Thanks a lot

Posted (edited)

The previous record would be based on an automated unique identifier serial number

Then you'll have to either make sure you have the necessary found set, sorted by the serial, or use a relationship to retrieve the value. There's probably a simpler way do whatever you're trying to do.

Edited by Guest
Posted

The "previous record" in this case is always the chronologically and physically previous record in the same found set.

So the calc Valuefield = GetNthRecord ( Valuefield ; Get ( RecordNumber ) - 1 ) works perfectly and accomplishes exactly what I needed.

Thanks for your help and very rapid replied.

This topic is 5894 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.