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.

calculated field that pulls data previous record

Featured Replies

  • Newbies

How can I define a field B that pulls the value of a different field (field A) in the previous record? I want a calculated field - not a script.

This is probably elementary, it is so simple to autoenter a value from a previous record - but I want it to calculate.

Version: v6.x

Platform: Mac OS X Panther

If your records have serial number, create a field that = serial number - 1. Make relationship from this field to the serial number. Use calculation = Relationship::Field. A lookup would be better in that it could go to the next lowest record if the preceding record was deleted. The lookup could be indexed.

If records are deleted the serial #s may have gaps. If deletion is not allowed, Ralph's method is fine. If deletion is an issue:

If you have a script to set up a list/portal: create a number field called sort order. Once you have a found set and it is sorted, have the script do a Replace Contents [sortOrder with serial #s.] Script usage is over now. Make the relationship using Ralph's technique, except use SortOrder - 1.

Will this work?

My bad: my technique isn't the best way to do this, I forgot something I just learned the other day...

Status(CurrentRecordNumber) will work if, and only if, the calculation containing it is set to unstored so it will recalculate using the portal's sort order. In the calc's options, check "Do not store calculation results -- calculate only when needed" in the Storage Options dialog.

You can do this without a script:

Create a field called myRecordNumber with "Status(CurrentRecordNumber)". In the calc's options, check "Do not store calculation results -- calculate only when needed" in the Storage Options dialog.

Create a second field called previousRecordNumber with "Status(CurrentRecordNumber) - 1". In the calc's options, check "Do not store calculation results -- calculate only when needed" in the Storage Options dialog.

Define a relationship between previousRecordNumber and myRecordNumber.

Whatever your calculation is, be sure to check if myRecordNumber=1, since the relationship wont work for the first record, e.g.:

If( myRecordNumber=1,

0,

theRelationship::theValueYouWantFromPreviousRecord

)

Ralph's idea for a lookup should work fine whether or not deletion is allowed.

Note:

A lookup would be better in that it could go to the next lowest record if the preceding record was deleted.

Therein lies the magic of lookups. smile.gif And it does not matter how many records may have been deleted in between; it will find the next lowest number, as long as one exists.

You're right, Ralph's method is just what's needed, my method is unnecessary. I've got to learn how to read (posts), and I've got to remember more details (lookups)... Only 9 months until next years New Year's resolutions...

Sam

Version: v7.x

Platform: Mac OS X Panther

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.