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.

Self-Join to sort records that have an empty field

Featured Replies

I have two sets of data:  rankings (Name, Rank) and partner_selections (Name, Name_of_Partner if have one yet).  I want for each person to calculate the best-ranked potential partner among people who do not already have partners (i.e. among records in which Name_of_Partner field does not contain a value, sort for the best associated ranking).  

I can do this by using a calculation field to hold the pairing_status (1 if have partner, 0 if don't), create a global field "Zero_placeholder" that holds the value of 0, and then do a self-join where names are not-equal and Zero_placeholder = pairing_status and sorting for the highest associated ranking. 

I would be interested in knowing whether there are more elegant ways to accomplish what I want without using a self-join and/or a global field. Would I want to create something like a for-loop that goes through each record, tests to see if the partner field is empty, then alters the value of a "highest_ranked_unpartnered_person" field if appropriate?

Thanks

P.S. I solved some problems with indexing in my previous attached examples.

 

 

Zero_placeholder_test_stripped.fp7

Edited by 'makerphile
Some issues resolved

We use a field ONE in every table. It's a number field with this auto-enter calc:

// Ensures that this field always reevaluates to 1

Let ( triggerOnChangesTo = Self ; 1 )

We use it during transactions to create/lock the record, and can also be used on the left side of a relationship to filter.

So, rather than a global 0, set this to be one the left of your relationship, and have it NOT = the pairing_status.

Oh, and sort the relationship by rank desc.

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.