3 Replies Latest reply on Aug 18, 2015 6:15 PM by philmodjunk

    Multiple Search Field Types in a Portal



      Multiple Search Field Types in a Portal


      I am trying to do a musical search return in a portal. I have several filed types (4 in total) to narrow the search:

      Two that are pull down menus based upon a related db (Genre and Tempo)

      Two that are open and contain several text data results which are separated by a comma (Keywords and Instrumentation) and the fields could contain: Keywords: (poignant, groove, reflective) or Instrumentation (guitar, bass, drums)

      I want the user to use as many or as little of the 4 fields to get the result and have it update automatically.

      How do I do that?

        • 1. Re: Multiple Search Field Types in a Portal

          It requires a complex filter expression on the portal. With 4 fields, this becomes a very long expression.

          Setting up a list view layout listing these records with global fields in the header would be simpler as then a script could set up and perform a find.

          Here's the portal fitler expression you might use for just two fields just to give you an idea of what is needed:

          ( IsEmpty ( LayoutTable::FilterField1 ) or LayoutTable::FilterField1 = PortalTable::Field1 ) AND
          (IsEmpty ( LayoutTable::FilterField2 ) or LayoutTable::FilterField2 = PortalTable::Field2 )

          And other expressions using Left or PatternCount can be used to search for text that the portal field "starts with" or "contains" instead of equals.

          • 2. Re: Multiple Search Field Types in a Portal

            Thanks for your response - that works with the pull down menus but with the text that I enter in, it draws blank - The 2 fields that have the text entries are Keywords and Instrumentation - In the graphic added, once I type in 'Drama' in keywords, everything disappears. Is that because I have 'Drama' in as the test Drama, Powerful, …?

            Here is the filter expression I used:

            ( IsEmpty ( Avid Mockup::Genre ) or Avid Mockup::Genre = Tracks::Genre ) and
            (IsEmpty ( Avid Mockup::Tempo ) or Avid Mockup::Tempo = Tracks::BPM ) and
            (IsEmpty ( Avid Mockup::Feel ) or Avid Mockup::Feel = Tracks::Keywords ) and
            (IsEmpty ( Avid Mockup::Instrumentation ) or Avid Mockup::Instrumentation = Tracks::Instrumentation )

            • 3. Re: Multiple Search Field Types in a Portal

              If you review my previous post, I indicated that you might need to use such functions as Left and PatternCount. No keywords field of any record in your portal table is equal to "Drama". Some records contain the text "Drama".

              PatternCount ( Avid Mockup::Feel ; Tracks::Keywords )

              would need to replace Avid Mockup::Feel = Tracks::Keywords

              And your expression is incomplete even when you use Patterncount for your keywords. You don't have expressions that will allow you to have two or or more empty fields and still get records showing in your portal.

              This is why I suggested using global fields with a scripted find instead of a portal as the resulting script would be much less complicated than the portal filter expression.