Cassetti Posted September 29, 2006 Posted September 29, 2006 I have a table with contact information for customers And i have a table for open service tickets. The fields are related by company. I have a button to send an email internally to announce the new ticket. I want the ticket to include the email addresses of all related contacts (related by company) Now I could use Count ( Contacts::EmailAddress) for an If statement, to determine if there are more than one contact records for that customer And i could use GetNthRecord ( Contacts::EmailAddress; 2) But what i want to know, is there any way to do a For Loop? Like For( TempVar; Start at 1; end at Count ( Contacts::EmailAddress); GetNthRecord ( Contacts::EmailAddress; TempVar) ) I know there is no for loop, but how can i do a conditional loop that doesn't force me to copy the same code over and over and change the numbers for each repetition It just seems so inefficient to me. Thanks in advance!
John Mark Osborne Posted September 29, 2006 Posted September 29, 2006 It would be really easy to do with the List function if you had FileMaker 8.5: List(Contacts::EmailAddress) If you want to use GetNthRecord, you'll need FileMaker Advanced to create a recursive custom function. GatherRecords (Field; Found) = Case( Found > 1; GetNthRecord(Field; Found) & "¶" & GatherRecords(Field; Found - 1); GetNthRecord(Field; 1) ) Once you have the recursive custom function, you can call it in a calculation using the following: GatherRecords (Contacts::EmailAddress; Count(Contacts::EmailAddress))
comment Posted September 29, 2006 Posted September 29, 2006 (edited) 1. Same as here. 2. You can also define a value list of e-mail addresses (only related values) and use ValueListItems() to get the values. Edited September 29, 2006 by Guest
Recommended Posts
This topic is 6691 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