Jump to content
Sign in to follow this  
Jim Lah

Fields vs Portals

Recommended Posts

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

Share this post


Link to post
Share on other sites

It seems to me that you calc is only checking for a valid relationship btw Level1 and Level2.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Now I see what you mean. Interesting...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

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