8 Replies Latest reply on Oct 16, 2013 7:44 AM by pdoak_1

    Dynamic Value List

    pdoak_1

      Title

      Dynamic Value List

      Post

            

           Info: OS X v 10.8.5
                   FM 12.0v4
                   Exprienced user
            
           I am trying to create a dynamic value list which updates as a word is typed. When the sufficient characters have been typed to narrow the list to one entry, I want to copy that entry into another field. I have found a way to create a dynamic list from a portal using this method
            
           However, once the list is down to one item, I cannot seem to grab the data from that row. If I use get nth record(field;1), it returns the first entry of the table and not the first entry of the portal. 
            
           Is there a way to retrieve the visible portal row.
            
           Many thanks

        • 1. Re: Dynamic Value List
          raybaudi

               You could sort the relationship instead of sorting the portal. That way the first record of the portal will be the same of the table.

          • 2. Re: Dynamic Value List
            pdoak_1

                 Thank you for your suggestion but I don't think that would work as the portal is not sorted, it is filtered, and I am not sorting the relationship or the portal.

            • 3. Re: Dynamic Value List
              philmodjunk
                   
                        However, once the list is down to one item, I cannot seem to grab the data from that row. If I use get nth record(field;1), it returns the first entry of the table and not the first entry of the portal.
                   Which is why the row in the portal is setup as a button so that you can complete the selection process by clicking it.
                   Have you tried enabling "auto-complete" for this field, possibly with a value list and a drop down list format?
                   Here's an example:

                   FileMaker 12 users: https://dl.dropbox.com/u/78737945/SimpleNameLookupDemo.fmp12
                   Pre FileMaker 12 Users: https://dl.dropbox.com/u/78737945/SimpleNameLookupDemo.fp7

                    

              • 4. Re: Dynamic Value List
                gcatnine

                     For what I have understood, you have to use

                     Go To Portal Row [Select;First]   (if you have just one line in the portal), Then copy the field

                • 5. Re: Dynamic Value List
                  philmodjunk

                       Hmm good idea, but how does the script determine that you have narrowed down the list to one matching item?

                  • 6. Re: Dynamic Value List
                    philmodjunk

                         Another option is to use a custom function or other calculation to "explode" the search text in the portal table into a return separated list.

                         If your text were "Apple", the text returned by this calculation would be:

                         apple
                         appl
                         app
                         ap
                         a

                         You could then dispense with the portal filter and use your search field in the layout's table as a match field to this return separated list and now you no longer have to deal with the limitations of a portal filter. (This is how we did this prior to the Portal Filter feature added in FileMaker 11.)

                    • 7. Re: Dynamic Value List
                      gcatnine

                           He said that the user has to type enough characters to down the list to one item.

                           To make it automatic it can do something like that:

                           Go to Portal Row [first]

                           $r1 = Get ( ActivePortalRowNumber )

                           Go to Portal Row [Last]

                           $r2 = Get ( ActivePortalRowNumber )

                           If ($r1 = $r2 ) ONE PORTAL ROW

                      • 8. Re: Dynamic Value List
                        pdoak_1

                             Gianandrea

                             Thank you. That worked. 

                             I have created a script trigger so that when the filter field is exited, the script is triggered to copy the first portal row into another field.

                             Phil

                             I don't need the script to determine when the list is down to one row as the script trigger only is invoked when the field is exited ie. the user will exit the field when only one entry is left in the list.