Jump to content
Server Maintenance This Week. ×

How to filter a portal using multiple global fields


This topic is 3387 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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)

 

  1. The portal works fine with no filtering
  2. 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.

 

Link to comment
Share on other sites

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
)
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 3387 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.