2 Replies Latest reply on Mar 28, 2014 4:49 AM by tommymang

    Showing a list of records with check marked fields (1 line for each check marked field)





      I'm fairly new to Filemaker Pro, hope someone can help me with the following:



      In my database each record has some fields (for example field5, field6 and field7) which have a check mark ON or OFF. Field1 is the title for the record.


      Now I would like to show a list of the records in which those fields have that check mark ON, but I want to show one line for each check marked field.


      Let's say I have 3 records: record1 has field5 check marked, record2 has field5 and field7 check marked, and record3 has field7 check marked.


      So the found list looks like this:


      field1 record1 - name field5 record1 ....

      field1 record2 - name field5 record2 ....

      field1 record2 - name field7 record2 ....

      field1 record3 - name field7 record3 ....



      As far as I know a found set of records normally shows 1 line for each found record (not more), so how do I go about to show more than one line for each found record that has more than one check marked field?


      And also how can I show in that list the name of that check marked field, in second position, after "field1 record#".


      Thanks in advance.



        • 1. Re: Showing a list of records with check marked fields (1 line for each check marked field)

          You're learning about context! There is only one record that exists, so naturally it can't be displayed in a format where more than one of the same record is listed.


          For this you need to get into one of two methods:


          1) Calculate some field(s) that display what you want to show. Basically "fool" filemaker into displaying multiple lines in one field.


          So your line "display" calculation above might look something like this:

          If ( field1 = "ON" ; "Record: " & Get(RecordNumber) & " Field 1 Name" & "" ; "" ) &

          If ( field2 = "ON" ; "Record: " & Get(RecordNumber) & " Field 2 Name" & "" ; "" ) &

          If ( field3 = "ON" ; "Record: " & Get(RecordNumber) & " Field 3 Name" & "" ; "" ) &

          If ( field4 = "ON" ; "Record: " & Get(RecordNumber) & " Field 4 Name" & "" ; "" ) &

          If ( field5 = "ON" ; "Record: " & Get(RecordNumber) & " Field 5 Name" & "" ; "" )



          Kind of messy, right? It's split out for display purposes, but there's some more elegant advanced ways to get similar results. But the above line can now be used to display multiple "lines" on a per-record basis. Some sliding controls on your layout can make it look better when you print/PDF it as a report.


          2) Virtual listing - this other method requires you to script the building of a "temporary" set of records to display your anticipated results. You would need to loop through your records above and create a "virtual" record for each line you want to display.


          This method is well documented in the community but is more advanced in the scripting requirement:







          There are probably other methods that people will chime in with, but the basic premise of context is that you either need a record for each line in the list you want to display, OR you need to return a list result to your single line, and adjust your layout accordingly.

          • 2. Re: Showing a list of records with check marked fields (1 line for each check marked field)

            Thank you very much Mike! I will give it a try.




            I used the "virtual listing" method, works like a charm. The first option was partially usable, but I had some problems with the layout.


            Again thank you very much!