title: Filemaker - Getting field values from related table
body: <p>I have the following setup in Filemaker Pro 10.</p>
  
  <p>Table1 with: id_table1, related_names</p>
  
  <p>Table2 with: id_table2, name, include</p>
  
  <p>and a joint-table with: id_table1, id_table2</p>
  
  <p>Now I want either make related_names a calculated field or write a script that sets related_names to a comma separated list of all names which are connected through the joint-table and have Table2.include = True.</p>
  
  <hr>
  
  <p>So for example a data set could look like:</p>
  
  <p><strong>Table1</strong></p>
  
  <p>id_table1, related_names
  1, "foo,bar" 
  2, "foo"
  3, ""</p>
  
  <p><strong>joint-table</strong></p>
  
  <p>id_table1, id_table2</p>
  
  <p>1,1</p>
  
  <p>1,2</p>
  
  <p>1,3</p>
  
  <p>2,1</p>
  
  <p><strong>Table2</strong></p>
  
  <p>id_table2, name, include</p>
  
  <p>1, foo, True</p>
  
  <p>2, bar, True</p>
  
  <p>3, baz, False</p>
  
  <p>After searching the internet for a few hours the closest I came was a calculated field
  with list(join-table::id_table2) which gives me a list with a all the id_table2's. But now I would need to find the appropriate records in table2 and check the include field.</p>
  
  <p>I hope the problem is clear. any help is highly appreciated.</p>