Are you wanting to put this button on the records in the portal, or on the main client record?
I want to put it on the main record
When you reference a related field from the parent table, the basic syntax is:
Doing this gets the first record (according to the sort order applied to the relationship; creation order if there is none). So it will always see the value in the first record. What record are you wanting to reference?
You can use the IsEmpty() function for that. When there are multiple related events, what do you want to happen?
Yes, that's the point. IsEmpty ( event::field ) will return the state of the first related record, which is perhaps not the record desired.
I'll need to look at the relationship perhaps. The button has the conditional formatting on it set to be either red or blue and I tried the Is Empty on the portal field but I'm not certain it was looking at the related record as it wasn't returning the correct result
As Mike said, the calculation evaluated from the context of the parent ("client") table will respect only the relationship as defined in the relationship graph. It will ignore the portal's sort order and filter, if any.
You really need to specify what you want to see if, for example, the field is empty in three portal records and not empty in two.
If you place this button inside the portal row, then the context references that single record (as others here have noted) and then the conditional formatting is simple as you can show the status of this field for each and every event that appears in the portal.
So I suggest that you describe in more detail exactly what you want and the significance behind this test to see if a particular field in the related table is empty. It may well be that one of us will suggest a completely different approach once you share the "bigger picture".
'Bigger picture' as follows:
Main layout has client address details etc. On it is a portal looking at 'events' table. Each client has an event which, when this happens shows in the 'events table and obviously the portal.
I'm looking at putting a 'front end' layout which will have a client list and this button so at a glance you can see who has had this event and who hasn't. Just trying to speed up the process.
First process is to get the button on client details layout to access a related record to see if the event has happened. There are fields which have date, time etc for the event itself, I can reference any of those to see if they're empty or not.
Hope that helps
Is clients—events a many-to-many situation? I suspect it is, in which case you need a join table to link a client to a particular event.
Re: "Each client has an event which, when this happens"—when What happens?
You will have to tell FileMaker which event you want. As we've said: Is there something that identifies the desired record? You can use an extra predicate for the relationship, for example.
The event itself is a product issue. The 'event' is the date of issue
You still haven't answered the questions:
How many of these exist for each client?
How many clients can be associated with s product / event?
How do you determine which product / event is the one that determines the CF?
We can't help you until we understand your setup.
I think this is what you have in mind:
You show a list of clients. You select one product issue (there are many ways to do this) and then all clients with that issue update to show whether they have the selected issue or not using some kind of visual indicator.
It's the "Select one product issue" that I am guessing about and would be the part missing from your description of the problem. But this is not something that would be based on testing whether a field is empty or not, but rather whether or not a given client has a related record matching the one currently selected for your dashboard view of the data.