2 Replies Latest reply on May 29, 2017 10:44 AM by olivervollmer

    How to select multiple records from a list view to store it in a virtual list ?

    olivervollmer

      Hi FileMaker developer,

      i have a list view of contacts. With a search and a category filter i´ll get a result of my contact-list. so far so good.
      Now i want to select from this fondest some Contacts to store their pk´s in a virtual list, to store these selected contacts in a new table (i will do that later with a Loop script).

       

      Here is a screenshots of my list view:

      Bildschirmfoto 2017-05-29 um 18.19.51.png

       

      On the right side in every row is a checkbox. on the top left is a textfield where i wanna store the pk´s.
      Now i want all id´s in that list to store it with a loop script in a new table.


      Why ? Because i want to save favorite contact lists in a new table.

       

      How is the best way to do that ?
      Please help.

        • 1. Re: How to select multiple records from a list view to store it in a virtual list ?
          erolst

          If you want to write out that list into records anyway, you could also use a $$globalVariable.

           

          Try this to add new values to the list, or remove existing ones:

           

          Set Variable [ $id ; Table::pk ]

          Set Variable [ $$favourites ;

            Case (

              $$favourites = $id ; "" ;

              IsEmpty ( $$favourites ) ; $id ;

              PatternCount ( $$favourites ; $id & Char(13) ) ; Substitute ( $$favourites ; $id & Char(13) ; "" ) ;

              PatternCount ( $$favourites ; Char(13) & $id ) ; Substitute ( $$favourites ; Char(13) & $id ; "" ) ;

              List ( $$favourites ; $id )

            )

          ]

           

          If you absolutely want to use a field, use Set Field[] and replace all reference to $$favourites with the field name; the logic remains the same.

           

          You don't need that checkbox on the right as a field; you could just have a checked and an unchecked graphic and hide each if (not) IsEmpty ( FilterValues ( Table::pk ; $$favourites ) ).

           

          btw, there is no apostrophe in the plural form of English words** ... (comp. "Deppenapostroph' ... ) ... just sayin'.

          • 2. Re: How to select multiple records from a list view to store it in a virtual list ?
            olivervollmer

            Thanks for the script...just works fine.

             

            Deppenapostroph.....sehr witzig , werde es mir merken. Will ja nicht auffallen

             

            Danke.