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.

Relationship to show most recent 10 records

Featured Replies

Hi Everyone,

I've struggled with this one once before, and ended up using a scripted solution, but I'm not really happy with using scripts if I can avoid it.

Basically, I am trying to set up a relationship that links to the most recent 10 records created. If anyone can tell me how, I'd be much obliged.

Obviously I could just set a portal to only have 10 lines, but that doesnt help for a web based solution. I really need there to be only 10 related records.

Cheers,

Sean.

Create a field that auto-enters serial numbers, increments of one (rec_number). Make sure it's a number field. Create another field that does a calc on it, basically comparing its own rec_number field against the Max(rec_number) of the entire table. If it's within 10, then it returns a "Y", if not, a "N".

Base your relationship for the ten most recent on the Y or N value of the record, which updates itself as records are added. No scripts needed.

I attached a small file that does just that, with a cutoff variable field too so you can easily set it show 10, 5, 3, 20, etc.

10_recent.zip

  • Author

Thanks for the effort Sharka.

But, I still can't see how this would work.

On my machine, max_rec_number always equals rec_number, so most_recent_YN always equals "Y".

Were you able to actually get a portal to only display the 10 records? Self-related is fine by me.

Cheers,

Sean.

Hmm, I see what you mean. I fixed the Max field thing. The reason a relationship won't work though is because the calc field upon which the portal would depend cannot be indexed. frown.gif

Basically, because the 'last ten' is a moving target, it's difficult (if not impossible) to quantify it in an indexed manner. This means that it's also difficult to base a relationship on the moving target (of whether it belongs to the last ten records or not).

This can be done easily through scripting, but you want no scripts.

If this is for the web however, you could use my attached solution, and simply hardcode the Lasso search to find records where the value is "Y". It doesn't care if the field it's searching is indexed or not.

I've attached a simpler setup

10_recentv2.zip

  • Author

Great, Sharka, you gave me enough to solve it that time.

I don't have Lasso, but what you propose sounds like it could be fairly slow, searching non-indexed fields.

I've attached my example in case anyone else can use it.

Technically all records appear in my portal, but only the most recent lines (qty set by user) appear, which is what I need.

For others to reference I put the CDML coding I'll use in there too (basic as it is).

Thanks for you help,

Sean Collier

recent_v3.zip

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.