1 Reply Latest reply on Jan 2, 2012 7:26 AM by Sorbsbuster

    Help with List() function

    DaleLyles

      Title

      Help with List() function

      Post

      I am missing a key point, I think, in how the List() function works.  I think that it's supposed to snag all instances of a field and list them, but I can't figure out to use it.

      Here's what I need it to do: I have a list of students from about 300 schools.  I need to find a subset of students and generate a list of those names to email to the contact person in each school.  I have a List field, and I set it to be a calculated field with List(StudentName) as the calculation. That produces no results at all.

      On the other hand, I started a quick test database and put two fields: Item and List.  I set List to calculate as above, and it will list the item in the record, but not all of them.  (I typed in five items just to see if it would list them.)

      Question: What am I missing?

        • 1. Re: Help with List() function
          Sorbsbuster

          You are thinking that it will list all the data in the records of a found set.  It won't - among other things it lists all the data in related records.  So if you had a self-join relationship, say, from the Student Table to itself, joined by ClassID, then the calculation:

          List (Students_SelfByClassID::StudentName )

          would list all the students who are in that student's class.

          There are several ways to achieve what you want.  You could create a script and attach it to a button which will copy the list to the clipboard and allow you to paste it into the body of an e-mail.  (You need a global text field available on the layout somewhere, even hidden. Or you could simply trap the list in a $Variable and make the script prepare the complete e-mail for you, of course.)

          For example:

          Enter Browse Mode
          Go to Record [First]
          Loop
          Set Field (gTextField ; gTextField & StudentName &  "¶" )
          Go to Record [Next, Exit after last )
          End loop
          Go to Record [First]
          Copy (gTextField )

          or

          Enter Browse Mode
          Go to Record [First]
          Loop
          Set Field ($MailList ; $MailList & StudentName &  "¶" )
          Go to Record [Next, Exit after last )
          End loop
          Go to Record [First]
          Send Mail <use the $MailList to start the body text of the e-mail>