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.

Featured Replies

Hey there,

If I wanted to find the highest value within a relationship I'd use

max(relationship::field)

How do I find the 2nd highest value?

Thanks,

Dan

Omit the highest valued records and use the Max() function again? Just guessing here...

Or you could do a find in the child file, using the relationship key as the "find" field, sort them in decreasing order and then go to record number 2.

Hi,

Category field

Price

MaxPrice by category = Max(selfjoinOnCategory::Price)

Intermediate Calc = Case(Price < MaxPrice by category,Price, 0)

MaxSecondHighest Price = Max(SelfjoinOnCategory::Intermediate Calc)

Intermediate2 = Case(Price<MaxSecondHighest Price, Price,0)

MaxThirdHighest Price = Max(SelfjoinOnCategory::Intermediate2)

...

  • Author

Thanks everyone,

These are great ideas. Ugo's solution does the trick and avoids using a script, so I'm declaring it the winner. ;-)

I hope I can get to the point where I'm answering half as many questions as I'm asking.

Cheers,

Dan

Hi Dan,

Actually, after re-reading all the answers, I think Vaughan had it the same way .

Omit the highest valued records and use the Max() function again? Just guessing here...

Just guessing here ?

I want to have Vaughan kids!!! grin.gif

  • Author

Oh yeah, I guess so. Thanks, Vaughn. It makes more sense now that I've walked through it.

Unfortunately, after I got it up and running, I realized that that wasn't quite what I was after. It's more subtle than that, and I'm not sure I can even really describe the problem. I'm still working on wrapping my head around it.

But thanks for the help. Always good to learn a new technique.

Dan

Ugo wrote: "I want to have Vaughan kids!!!"

ROTFLMAO!

I'm still clueless with this "children"/ "kid" problem. And I'm now clueless with ROTFLMAO....B)grin.gifconfused.gif

Too many secrets wink.gif

Rolling on the floor laughing my a.. off

smile.gif

  • Author

Hey Guys,

Now that everyone has ROTF and LTAs off, I figured out what my real question was. (Must be all that laughing relieved some stress and helped me to clarify my thought process.) :-)

I didn't just want to find the second highest value in a relationship, but the highest value in a relationship that is less than the current value.

For example...

A 1

B 2

C 3

D 4

E 5

So for record B, the highest value that is less than B's value (i.e., 2) is 1. For record C it is 2. For record D it is 3, and so forth.

Any thoughts on how to find this one? I'm thinking that I'll have to rely on a script for this. Yet in the back of my head I still think I can do it with a calculation. But my logic centers must be out of whack, 'cause I can't get this.

Thanks,

Dan

Hi Dan,

Scripted method I think.

Set fied g_record_ID (record_ID)

Go to related record (show all)

Sort on your number field descending

Loop

Go to next record

End Loop when Record_ID = g_record_ID

Go to previous record

Omit

Show omitted.

  • Author

Thanks Ugo,

I've gone with the script method. The actual situation was quite a bit more complex than I described, so the script got pretty convoluted. But your's was a good starting point. It seems cumbersome -- at least it was to write -- but it works and it seems pretty quick. We'll see once I get the db full of data.

Cheers,

Dan

Hi Dan,

This scripting method would lead you to another layout, isolating (omitting...) one record...Not really dynamic....

Depending on your file structure and interface needs, you should take a look at "fixed portals" at http://www.fmfiles.com or even DJ's renumbering portal in the sample section.

Scripting the find using these solutions, would offer you a cleaner way to view at the fly within the current layout (you surely have some room left) the record you are looking for, even highlightting it.

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.