8 Replies Latest reply on Feb 8, 2014 11:14 AM by PaulWirth

    List function only returning one value

    PaulWirth

      Title

      List function only returning one value

      Post

           I must be getting something wrong with the List function.

           I have a table (Table 1) of dates of appointments with associated names. That table has a relationship based on the name field with a table (Table 2) of contact information.

           I want to display a list of all appointments (from Table 1) for a given contact in Table 2.

           The field "Appointments" in Table 2 has this formula: List ( Table 1::Date ), but it only returns the first appointment, not all of them. What am I missing?

            

        • 1. Re: List function only returning one value
          philmodjunk

               Each date will be separated by a return and thus be listed as additional rows of text in the field. If your filed is only one row tall, you'll only see one date unless you click or tab into the field. Could that be the case here?

          • 2. Re: List function only returning one value
            PaulWirth

                 Hi Phil,

                 Clicking on the field and also expanding it so that it shows more than one line doesn't help. Still only one item, where there should be many.

                  

                 It's weird, I thought I had it working before. I have similar fields, one for the most recent appointment (using Max) and the earliest (using Min), and they're working.

                 Any other thoughts?

            • 3. Re: List function only returning one value
              philmodjunk

                   It would appear that there is only one record from the context from which the field evaluates. If you put a portal to Table 1 on your table 2 layout, what do you see in the portal?

              • 4. Re: List function only returning one value
                PaulWirth

                     Nothing shows up in the portal as well, when I link it to the matching name field. There are definitely multiple records connected to the names I'm checking this with.

                     The name field in Table 2 (the contacts table) is calculated by First & If(IsEmpty(Last);"";" " & Last) where First is first name, Last is Last name (the calculation adds a space if there's a last name present). This matches the names in Table 1 (the appointments table), which are in the format Firstname Lastname. Just to be extra sure, I copied Table 2's calculated First + Last name for a contact and pasted that into a search in Table 1, and multiple appointments show up. Hope that makes sense.

                • 5. Re: List function only returning one value
                  PaulWirth

                       My second paragraph above is really not to the point, since the relationship obviously connects the name fields enough to give the correct date for the first appointment.

                        

                       But why would it only give the first date and not all subsequent ones?

                  • 6. Re: List function only returning one value
                    philmodjunk

                         If an unfiltered portal to the same table occurrence that you used in your List function cannot list the records you expect, then List will not either. You'll need to analyze your relationships and the values of the match fields used in those relationships to see why the expected records don't appear in the portal. Once they can appear in the portal, a calculation using List ( ) will be able to return the same list if it refers to the same table occurrence from the same context as your layout.

                    • 7. Re: List function only returning one value
                      PaulWirth

                           Thanks Phil. I'm attaching a simple example database. If you have the time, perhaps you (or anyone else) can see what's going wrong.

                           It's the Appointments field that uses the List function. I've included a portal as well.

                           The relationship seems to be set up fine, as the calculated appointment counts, first appointment, and last appointment fields are accurate. It's just the List function that seems like it's misbehaving (or rather, I've missed something crucial).

                      https://dl.dropboxusercontent.com/u/5187606/List%20function%20problem%20test.fmp12

                      • 8. Re: List function only returning one value
                        PaulWirth

                             Problem solved. The List calculation field was set as date format. When I set it as text format, all the dates appeared.