1 Reply Latest reply on Jan 14, 2017 6:34 PM by philmodjunk

    Filter Portal with Multi-key value

    dangelsaurus

      I have a project with the following tables (only relevent fields included below)

      • proposals
        • gSearch_Categories (global field)
      • proposals_details
      • products (including a table occurrence prt_products which has a Cartesian join to proposals)
        • id
        • name
        • category_id (multi-key field)
      • categories
        • id
        • description

       

      I have a portal which displays a list of products from prt_products, and I would like to be able to use a portal filter to allow for a product to be in more than one category, however the filter is only picking the first value from the multi-key field.

       

      The portal has radio boxes which correspond to the categories

      The portal filter is setup as follows (1 is "All")

      If (PROPOSALS::gSEARCH_CATEGORIES=1; 1; prt_PRODUCTS::CATEGORY_ID = PROPOSALS::gSEARCH_CATEGORIES) ;

       

      what is needed for the filter to work as desired (allowing for multiple values of category_id)

       

      products

      idnamecategory_id
      1Dog

      2

      3

      2Cat

      2

      3

      3Human3
      4Fish2

       

      categories

      iddescription
      1All
      2

      Pet

      3Mammal
        • 1. Re: Filter Portal with Multi-key value
          philmodjunk

          While a portal filter is possible, the expression will be complex to set up if you have more than 2 or three categories.

           

          It would be much simpler to use this relationship:

           

          proposals::gSearch_Categories = products::category_id

           

          With gSearch_Categories formatted with check boxes for every category, selecting two category check boxes would cause the portal to list products from both categories and you can then easily select as many or as few categories as you want. (We've been using this trick with portals since before filtered portals were possible in FileMaker. )