AnsweredAssumed Answered

Strange Auto Enter Calculation Behavior (do not evaluate evaluates and vice versa!?)

Question asked by johnhorner on Feb 19, 2011
Latest reply on Feb 21, 2011 by johnhorner

Title

Strange Auto Enter Calculation Behavior (do not evaluate evaluates and vice versa!?)

Post

I am experiencing what I think is some very strange auto-enter calculation behavior.  I have a phone number portal on a contacts layout.  the phone numbers in the portal are sorted by a "SortOrder" field.  The SortOder field is set up with an auto-enter calculation:

SortOrder = contacts_PHONENUMBERS_HighestSort::SortOrder_PhoneNumbers + 1

the point is to have newly created phone records appear at the bottom of the portal which is sorted by the "SortOrder" field in ascending order.  contacts_PHONENUMBERS_HighestSort is a relationship that links all of a contacts phone numbers, but sorts them in descending order.  As long as there are records present, and the "do not evaluate if all referenced fields are empty" checkbox is checked, it works fine.  however, if there are no records present, it fails to enter a value as you would expect.  However, if you uncheck the "do not evaluate..." checkbox, the calculation enters a value of "1" into every record regardless of whether there are already other records present, and regardless of what values are in their "SortOrder" field.  Does anyone know why this is not working or what I am doing wrong?

Alternately, does anyone have a good method for automatically entering a value into a field a new related record created in a portal that is equal to the highest value in that field for all related records plus 1?

Outcomes