November 2, 200817 yr 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
November 2, 200817 yr 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
November 2, 200817 yr 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.
November 2, 200817 yr Author OK so I tried this; If( MyFamilyMembers::NameFull = NameFull; 1;.9 ) But the calc. still returns a "1" for everyone.
November 2, 200817 yr Perhaps you should post your file (just the 2 TO's with some sample data would be enough).
November 2, 200817 yr 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
November 2, 200817 yr 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.
November 2, 200817 yr Author AAAAAHHHHHHHH!! Thank you everybody! The answer is always hiding in there somewhere! Regards, Phil
Create an account or sign in to comment