2 Replies Latest reply on Jul 13, 2012 5:24 PM by JoeStack

    Using check box to filter a portal

    JoeStack

      Title

      Using check box to filter a portal

      Post

      I have a checkbox which has active, pending, and complete as its options which goto a global field. Below I have a portal which in the filter box i have if filter as " gobalfield = status ". Then i have a script that refereshes the page and flushses the cached results when the value is changed (not sure if this is needed to refresh the portal or if there is a better way). If filters it when only one item is checked, but when two are checked it shows nothing. If i select active and pending, i want it to show all fields active or pending, not active and pending. After searching the forums, supposedly this works, but for some reason i cna't get it to work. Any suggestions? Thanks!

        • 1. Re: Using check box to filter a portal
          philmodjunk

          If you have a field with a set of checkboxes and click two or more checkboxes, all the selected values are stored in the field, separated by returns.

          Thus if you click "active" and "Pending", you will find either

          Active<return>
          Pending

          or

          Pending<return>
          Active

          depending on which check box you clicked first.

          Thus, any expression that uses = to compare this to field to a specific value or a field storing one specific value will never be true.

          You could use an expression with the FilterValues function, but I suggest an "old school" approach when using check boxes to filter a portal like this.

          Currently, your portal's table is related to the layout's table in some sort of relationship such as:

          LayoutTable::PrimaryKey = PortalTable::ForeignKey

          Modify the relationship to be:

          LayoutTable::PrimaryKey = PortalTable::ForeignKey AND
          LayoutTable::GlobalField = PortalTable::Status

          This will not need any scripting to refresh the portal nor is any portal filter required. THis relaitonship exploits the fact that if you have a list of values in a fields separated by returns, it will match to related records by any one value in the list. In the above example, selecting "active" and "pending" would mean that any record with "pending" OR "Active" in the status field will match to the GlobalField and appear in the portal.

          • 2. Re: Using check box to filter a portal
            JoeStack

            Thnaks so much for the help! I hope you don't mind the trivial questions. For some reason the complicated logic and aspects of the program i can figure out, but the trivial things i can't. I make sure to search the web, documentation and forum as best i can before posting so i don't spam it, but sometimes i can't stumble across the answer. Thanks again.