Jim Lah Posted February 5, 2009 Posted February 5, 2009 Please can someone help my understanding of a simple relationships issue. The attached illustrates the problem. I have a single table, with an ID and Parent ID to relate the tables occurrences together - 4 tocs are included each related in the same way. I have a simple calculation which looks at the ID of the child toc. If the field is empty, it assigns "empty", if not it assigns "not empty" - ie simply detecting the presence or otherwise of a related record. When I show the Portals for the 4 tocs in the layout, they display "Empty", "Not Empty" or nothing (if no record there) as expected. However, if I show the associated field values, they always show "Empty" or "Not Empty" - even when there is no associated record in that relationship. How can this be if there is no record present to actually display the calculated result? I'm sure someone out there will be able to explain this "feature". Jim POC_Table_Error.fp7.zip
bcooney Posted February 5, 2009 Posted February 5, 2009 It seems to me that you calc is only checking for a valid relationship btw Level1 and Level2.
Jim Lah Posted February 5, 2009 Author Posted February 5, 2009 Yes, Correct. That's all the calc is doing in this example. If there's nothing there is should say "Empty" - which it does in the Primary field My problem is that where there is no valid relationship it also shows "Empty" in the secondary field - even though there should be no record there.
Jim Lah Posted February 6, 2009 Author Posted February 6, 2009 It's certainly confused me as I have been using IsEmpty () thinking it was a reliable way of testing for a record's presence as well as for content of the field. In the attached I've taken it a step further by comparing results with using If ( x = "" ; "Empty" ; "Not Empty ). The results are even more confusing - none of them simulate the (correct) result as shown in the Portals. If I check the box to evaluate when records are not present, then it simulates the IsEmpty function - giving me Virtual records of some kind. If I check the box not to evaluate if records are not present, then is does what you would expect. Attachment shows the results. POC_Table_Error.fp7_2.zip
comment Posted February 6, 2009 Posted February 6, 2009 You may be reading too much into this. The difference between a field in a portal and a field placed directly on a layout is NOT in the evaluation, but in rendering. When there's no related record, a portal row is completely empty - nothing is drawn there. Consequently, nothing needs to be evaluated. OTOH, a field placed directly on the layout must be rendered (put some borders on the fields to see the difference). Once it's rendered, the question of what to put in it comes up. Since it's unstored and set to evaluate always, Filemaker evaluates it (note that IsEmpty() is used to check for the existence of related record, and thefore evaluates too). Thus you get the quirk of evaluating a field (correctly, it needs to be said) from the context of a non-existing record.
Recommended Posts
This topic is 5828 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now