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.

Getting portal row number for a calc.

Featured Replies

Hi All,

I have a table of students. To group those from the same family I use a self-join relationship based on surname & home phone and display them in a portal. Both the relationship and the portal are sorted by student contact hours, descending.

I need to calculate a family discount rate so that if the student falls into the top row of the portal, they calc as 1, otherwise as 0.9

Since there seems to be no First() function, I changed the relationship & portal sorts to descending and used

If(

Last(MyFamilyMembers::NameFull) = NameFull;

1;.9

)

My flawed logic: "If I am at the person at the bottom of the list, give me a 1, otherwise give me a 0.9"

All family members end up with a "1" .

Any suggestions

From what context is this calculation defined?

  • Author

From the context of the Students table

I meant: from which occurrence of the Students table?

  • Author

The same occurrence as the layout containing the portal.

Attached are some screen shots in case that makes it clearer.

Read 'Gymnasts' as 'Students'.

Thanks, Phil

Studentfamily.zip

I need to calculate a family discount rate so that if the student falls into the top row of the portal, they calc as 1, otherwise as 0.9

Since there seems to be no First() function, I changed the relationship & portal sorts to descending and used

If(

Last(MyFamilyMembers::NameFull) = NameFull;

1;.9

)

My flawed logic: "If I am at the person at the bottom of the list, give me a 1, otherwise give me a 0.9"

All family members end up with a "1" .

It's a work around for something that actually has an easy answer.

You're right, there is no First() function. But if you simply reference the field itself, the "top row of the portal" is returned (assuming the portal is sorted the same way as the relationship, or not at all).

The First() function for related reocrds is to simply not use a function at all.

  • Author

OK so I tried this;

If(

MyFamilyMembers::NameFull = NameFull;

1;.9

)

But the calc. still returns a "1" for everyone.

Perhaps you should post your file (just the 2 TO's with some sample data would be enough).

  • Author

That would be great if you could have a look. It was a huge file so it's taken a while to empty it.

Use acct name: ph

password:1234

The calc field is the last one in the Gymnasts Table 'Family Rank'

The family members portal is on the layout 'GymnastDetail'

Many thanks, Phil

Gym.fp7.zip

The calculation returns the correct result. However, the field is formatted to display as decimal with 0 decimal digits - which makes a result of 0.9 APPEAR as 1.

  • Author

AAAAAHHHHHHHH!!

Thank you everybody!

The answer is always hiding in there somewhere!

Regards, Phil

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

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.