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.

previous records calc

Featured Replies

Without a script, is there a calc that can pull information for the previous or next record?

The inherent problem is that, as you perform finds, sorts, etc., the "previous record" can change.

Certainly you can pull info from one record and insert it into the next. One simplified example:

code:


GoToField(FieldWithInfo)

Copy

GoToRecord (Next)

GoToField(FieldWaitingForInfo)

Paste

This may be oversimplified, and there are other ways to script it, but it works.

  • Author

I have a list of records in a portal and based on record type I want to get a value from the record above and the record below.

I am trying to avoid a script because there will be thousands of records and a script would be to tedious.

There is not a concern about the records above and below changing because it is in a portal and entry order is the sort.

-----------------------------------------------

"There is not a concern about the records above and below changing because it is in a portal and entry order is the sort."

-----------------------------------------------

WARNING! This may not be true! The state of a portal, i.e. shown records, sort order etc. does not necessarily represent the state of the database.

This means that go to record commands etc. will work on the sort, find order of the actual found count, and not the portal. Copying info from previous records can be a dangerous thing. Especially as for FMP the previous record is not necessarily the record before the record you are currently on. What I mean with this is the following:

If you have 5 records listed, and you are currently on record 3, and take info from the previous record, FMP does not immediately presume you mean record number 2. FMP will grab info from the last visited record, so if you have clicked into record 3 from record 5, it will copy info from record 5.

This is explained pretty well in the FMP help files.

Rigsby

Rivet,

Not sure I understand you, but, say you are testing data in row 3 of a portal and based on the result, you want to grab info from the records relating to rows 2 and 4 in the portal, then you can do this.

To illustrate, you need 3 fields: gportal_row, (a number field) and 2 texts fields - info_above and info_below. Then one script set to a transparent button on the first portal row so that it replicates on all portal rows.

Set Field (info_above,"")

Set Field (info_below,"")

Set Field (gportal_row, Status(CurrentPortalRow) -1)

Go to Portal Row ( gportal_row, By Field Value)

Set Field (info_above, rel::data_you_want)

Set Field (gportal_row, gportal_row +2)

Go to Portal Row ( gportal_row, By Field Value)

Set Field (info_below, rel::data_you_want)

Set Field (gportal_row,"")

Go to Field()

Clicking in any portal row will generate a result in info_above and info_below. You'd probably want to modify this to trap for odd results if you're clicking in the first or last portal row. And you'll need to script the test for the record type; wasn't sure whether you want it performed on the related record or the record you are currently browsing.

HTH

quote:

Originally posted by rivet:

I have a list of records in a portal and based on record type I want to get a value from the record above and the record below.

I am trying to avoid a script because there will be thousands of records and a script would be to tedious.

There is not a concern about the records above and below changing because it is in a portal and entry order is the sort.

You'll need to implement an "linked list" structure and than you can interrogate records via relationships "myParent" and "myChild"

Dj

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.