Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to filter a portal using multiple global fields

Featured Replies

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.

 

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
)

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.

  • Author

Thanks for those suggestions Wim and comment - Both solutions worked well.

 

Will read up on the operator precendence to better understand why.

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.

  • 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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.