AnsweredAssumed Answered

Number of records in set?

Question asked by pauhana658 on Jul 18, 2012
Latest reply on Jul 21, 2012 by JimMac


Number of records in set?


Newbie here -- well, plenty of programming experience, but new to Filemaker and having lots of problems with FM's scripting language. 

Here's what I want to do in plain English. I have an Invoice table with two fields for Client and Contact. The Client field gets its data from the related Client table, and the Contact field gets its data from the Contact table that is related to the Client table. When I create a new invoice, I select a name from the Clients popup. This action fills the Contacts popup with only those contacts related to the selected client. I then select a contact from the Contacts popup. All well and good and working as expected.

But if the client I select has only one Contact associated with it, I'd like the contact field on the Invoice layout to be automatically filled with the contact name from that single Contact record. Saves a bit of effort. 

How can I determine the number of records in a current set of related records? Get (Found Count)? If so, then where do I find and how do I use the returned value? The following doesn't work, probably because I am not specifying the related table for the found count. (Should be the Contacts table.)

If [Get(found count)=1]

      Invoices::Contact = Contacts::Contact Name

end if

Any help would be greatly appreciated!