5 Replies Latest reply on Jan 27, 2011 12:33 PM by JustinLevens

    List Function Woes



      List Function Woes


      I'm fairly new to developing in Filemaker.  Most of my experience is in VB, so learning Filemaker has been somewhat frustrating.  I know how to do what I want to do in VB, but figuring out how to execute things in Filemaker has proven diffucult.

      Anyway....what I'm attempting to do is list all the email addresses from a given table in one field using the list function.  I have a script that filters the list how I want off global variables using drop-downs.  So I have the records, then I want to use the list function to grab the emails of these records and plop them into a field/variable in my script.  The issue I keep having is the list function only grabs the first record from my filtered list.  Could it be a relationship issue?


        • 1. Re: List Function Woes

          I don't see any use of the List() function anywhere in your script. You have a variable named $surveyList, but you aren't using the list function to put a list of values into this variable, just the value of survery_identifier for the current record.

          Even if you were to use List such as this step: Set Variable [$SurveyList ; Value: List ( Assessments::survey_identifier) ]

          You'd still get just the value or values from the current record.

          In order for List to return a list of values from a group of records, you have to refer to the records via a relationship--which you can't do with the approach you are using in your script.

          Using your scripted find to pull up the selected records, you'd need one of the following sets of scripts inserted after the Perform Find[Restore] step:

          Go To Record [First]
             Set Variable [$SurveyList; value: List ( $SurveyList ; assessments::survey_identifier )]
             Go To Record [next ; exit after last ]
          End Loop


          Go To Layout [//specify a layout based on assessments, but with only assessments::survery_identifier present on this layout]
          Copy all Records
          Go To layout [//specify a layout where a field for holding your list of values is present on the layout]
          Paste [//specify the field where you want your list of values]

          • 2. Re: List Function Woes

            The List Function will return a list of all the e-mail addresses in the related records.

            If you can determine the set of records you want by relation then the list function will return exactly the list you want.

            Alternatively, you can generate the equivalent in a $Variable from any found set by setting a script to loop down the list and set the collecting variable to be:

            Go to record [first]

            $EmailAddressesList = ""


            $EmailAddressesList = $EmailAddressesList & "¶" & EmailAddress

            Go to Record [Next; Exit after last]

            End Loop

            • 3. Re: List Function Woes

              Awesome!  Thanks for the recommendations.  I figured it would likely take some sort of loop, but someone recommended using the List() funciton, so I attempted that route.  I'll try one of these and let you know the outcome.  I foresee a lot of posts coming from me onto these forums.  Hopefully, I'll be able to return the favor one day.

              • 4. Re: List Function Woes

                If you look carefully, you'll find that I did use the list function Wink.

                As written, it produces the same list as does Sorbsbuster's example, so take your pick.

                • 5. Re: List Function Woes

                  Thanks again...got it working perfectly!  Just added a simple loop.