6 Replies Latest reply on Apr 18, 2016 8:55 AM by ZoocMan85

    Search Results Portal View

    ZoocMan85

      Hey Everyone,

       

      I have two tables, customers and customers search results. Customer search results is another Table Occurrence of customers which I have displayed in a portal. What I'm trying to do is when I do a search in customers which is the top fields here, I want only the records found to show in the portal. Here is a screen shot.

       

      Screen Shot.jpg

        • 1. Re: Search Results Portal View
          erolst

          If you have FM 13 or 14, create a summary field, type ListOf: primaryKey.

           

          Create a global text field and use it for a self-join relationship between Customers and another Customers TO (e.g. CustomerSearchResults), where

           

          Customer::gFoundIDs = Customers_searchResults::primaryKey

           

          When you've found matching records, write the summary field contents into the global field.

           

          btw, while you need a dedicated table occurrence for the self join, it is not necessary for performing the search; you could simply open a new window (which can be positioned outside the screen bounds), perform your search, set the global field and close the window.

          • 2. Re: Search Results Portal View
            ZoocMan85

            Im confused erolst.

             

            I created another TO  Customer Search  which is based off of customers.

             

            I created a field Customer Search Results Global text field and made joined it to the table Customer Search .

             

            So Customers::Customer Search Results = Customer Search:: Customer Search Results.

             

            Im confused after this point.

            • 3. Re: Search Results Portal View
              erolst

              ZoocMan85 wrote:

              Im confused after this point.

               

              Check out the attached sample file. Note that switching the layout seems to work faster than opening a new window … but I included both ways.

              • 4. Re: Search Results Portal View
                ZoocMan85

                Erolst thank you so much for the demo file it was very helpful. It has gotten me 80% there but im having two issues.

                 

                1. The search on layout switch isnt working. I checked all fields relationship. Im using filemaker pro advanced 14 so im not sure if that has anything to do with it but here is my script.

                Screenshot.jpg

                 

                If i run the debug, its fine until I get to the IF Get Found Count and it throws an error of 401 no matching records.  I copied everything in your demo file to a T. I dont know what im doing wrong.

                 

                2. When you hit show all records, the records will all show perfectly , but i set the field as a button to go to that related record. However it doesn't go to the related record. It will just bring you to the first record that's in the database for customers. I have it set to go only to the matching record as well. Thank you again for all your help.

                • 5. Re: Search Results Portal View
                  ZoocMan85

                  I figured it out just now. I had for CName Calc results as number and not text. Still having issues tho with the found records. On issue 2.

                  • 6. Re: Search Results Portal View
                    ZoocMan85

                    I figured out issue 2 just now. I had it set to customers instead of customer Search table. Thank you again so much for your help.