January 15, 201510 yr Hi there, I have a situation where I need to filter a portal based on multiple global fields. I have setup scripts that will filter a portal based on one global field but I can't seem to pull the logic together to have the portal filtered by multiple global fileds. Here's a bit more detail: Global Filter fields: => Globals::zz__ProductDeviceFilter__gxt => Globals::zz__ProductTypeFilter__gxt Which are populated from a dropdown menu. The portal is showing related records that have a "Device" field and a "Type" field. I'm using portal filtering (which is being refreshed every time one of the global fields is being updated) The portal works fine with no filtering The filter works fine when I try filtering using only one global field eg. devices The following filter calculation works if I just try and filter using one global field for filtering eg. "Devices" IsEmpty ( Globals::zz__ProductDeviceFilter__gxt ) or PatternCount ( Products Popover::brand_name ; Globals::zz__ProductDeviceFilter__gxt ) > 0 As soon as I try and add the second global field into the mix, the filter filters out all records so basically the portal is empty. IsEmpty ( Globals::zz__ProductDeviceFilter__gxt ) or PatternCount ( Products Popover::brand_name ; Globals::zz__ProductDeviceFilter__gxt ) > 0 and PatternCount ( Products Popover::type ; Globals::zz__ProductTypeFilter__gxt ) > 0 I want the filter to only show records that contain both the selected "Device" and "Type" So just to re-iterate, the part I'm stuck on is the portal filter calculation - the rest of the mechanics of refreshing the portal after filter selection etc work fine. Any calculation suggestions would be much appreciated.
January 15, 201510 yr what if you use parentheses: IsEmpty ( Globals::zz__ProductDeviceFilter__gxt ) or ( PatternCount ( Products Popover::brand_name ; Globals::zz__ProductDeviceFilter__gxt ) > 0 and PatternCount ( Products Popover::type ; Globals::zz__ProductTypeFilter__gxt ) > 0 )
January 16, 201510 yr Try: ( IsEmpty ( Globals::zz__ProductDeviceFilter__gxt ) or PatternCount ( Products Popover::brand_name ; Globals::zz__ProductDeviceFilter__gxt ) ) and ( IsEmpty ( Globals::zz__ProductTypeFilter__gxt ) or PatternCount ( Products Popover::type ; Globals::zz__ProductTypeFilter__gxt ) ) Lookup the logical operators precedence.
January 16, 201510 yr Author Thanks for those suggestions Wim and comment - Both solutions worked well. Will read up on the operator precendence to better understand why.
January 16, 201510 yr Both solutions worked well. That's not possible. Wim's suggestion is identical to your (last) formula. The AND operator is evaluated before the OR operator, so the added parentheses are redundant.
January 17, 201510 yr Author That's odd, I'm sure I tried both variations. I'll go back and retest it.
Create an account or sign in to comment