7 Replies Latest reply on Apr 9, 2012 9:57 AM by philmodjunk

    Show search results in portal



      Show search results in portal


      I've been searching for different techniques to use a portal within a layout to show search results.  I found this technique: http://www.filemakermagazine.com/videos/portal-results-showing-search-results-in-a-portal-and-more.html but it's from 2004, so I wasn't sure if there is an easier solution now.  Say the user searches a field for a certain state, I'd like the layout to show the search results within a portal sort of window on the side while also being able to access the record in a single form view.  When you click a record from the portal/search results, the main record is updated but the portal continues to show the search results, allowing the user quick access to all of the records.


      Thanks for any insight.

        • 1. Re: Show search results in portal

          Take a look at the portals in the bottom of the layout of this demo file: http://www.4shared.com/file/plr_jbkk/EnhancedValueSelection.html

          Do they pull up records in the portal like you'd want?

          The scripts in this demo create new records in the line items portal, but they could be modified to display a selected record from the portal instead.

          • 2. Re: Show search results in portal

            Hi Phil,

            The Demo only show the search by Product Description, is there any way you can add another search field to search by Product ID? I tried duplicating everything (cartesian relationship, script, forumla in filter portala option), but it doesn't seem to work. Am I missing something here?

            • 3. Re: Show search results in portal

              Yes, it can be done.

              Describe how you'd want that to work.

              Once search field where data in it is matched to both fields?

              Match to all records where the data for product ID matches AND the data for description matches?

              Match to all records where the data for product ID matches OR the data for description matches?

              When experimenting with such a set up, you may want to use Refresh Window [flush cached join results] as a script step executed each time a search field is updated. If that's all it takes to get things to work, then the basic design is OK, it just takes some creativity to set up an update process that avoids needing this script step (which can result in very slow screen updates in many cases.)

              • 4. Re: Show search results in portal

                For example, you have two search fields in one layout, one for Product ID and one for Product Description. The user have the option to search based on Product ID OR Product description, OR to use both search field to narrow down the search in case one Product ID has two descriptions (ie, color, material, etc). The portal will filter based on these options. 

                I think there may need to be a script to distinguish between different search fields.

                • 5. Re: Show search results in portal

                  What do you mean by "one product ID has two descriptions". Does this mean you'd have two product records with the same Product ID but different descriptions? Generally, it's better to have unique product ID's....

                  Assuming I'm understanding that sentence correctly, you can set up a portal filter expression like this:

                  Let's call the two global fields: gProductIDSearch and gProductDescSearch.

                  ( IsEmpty ( YourTable::gProductIDSearch ) and PatternCount ( PortalTable::ProductDesc ; YourTable::gProductDescSearch ) ) or
                  ( IsEmpty ( YourTable::gProductDescSearch) and PatternCount ( PortalTable::ProductID ; YourTable::gProductIDSearch ) ) or
                  ( PatternCount ( PortalTable::ProductDesc ; YourTable::gProductDescSearch and PatternCount ( PortalTable::ProductID ; YourTable::gProductIDSearch ) ) or
                  ( IsEmpty ( YourTable::gProductDescSearch ) and IsEmpty ( YourTable::gProductIDSearch ) )

                  This expression does partial string matching on both fields. You might choose to format gProductIDSearch with a value list of ID's and use a straight = comparison, but the overall expression is the same.

                  • 6. Re: Show search results in portal

                    Hi Phil,

                    Thanks! It worked. I didn't realized you can do parenthesis in a parenthesis. I see your logic in the calculation. Perhaps it can also be expanded to do more than 2 search fields. 

                    • 7. Re: Show search results in portal

                      It can be so expanded thought the expression can get pretty hairy. Some developers try to  get a bit more order to such a complex expression by using a Case function to break up the "Or" terms into pieces, returning 1 or True as the return value when the expression evaluates as True.