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.

'If' with 'and' and multiple 'or' in a statement

Featured Replies

Hi FMForums Community,

When searching for Table::Type1 = "ABL" in my (1000 record) database I get 300 records.  I've added a Portal and within the "Filter Portal records" option I wrote the following:

If ( Table::Type1 = "ABL" and ( Table::Type2 = "XA" or Table::Type2 = "YA" or Table::Type2 = "ZA") ; Table::ID ; 0 )

I should be retrieving only 50 out of the initial 300 records but I'm still retrieving all 300 records where Type1 = ABL. The 50 records that fulfill criteria are visible and the other 250 are appearing blank.

When I write:

If ( Table::Type1 = "ABL" ; Table::ID ; 0 )

I retrieve just the 300 expected records. I don't understand why the filter is displaying blank records if the script seems to be filtering properly.

Any suggestions for making the "Filter Portal records" show just the 50 records?

Best,

Daniel

 

Can you post a simple file showing the problem (and hopefully only the problem)?

--
Note that your filtering expressions are unnecessarily convoluted. The result of a filtering expression needs to be either True or False. Your expressions return Table::ID instead of True. We don't see the contents of the Table::ID field, so we don't know what it will return when converted to a Boolean. This is probably not the cause of the problem you raise, but instead of:

If ( Table::Type1 = "ABL" ; Table::ID ; 0 )

you should be using:

Table::Type1 = "ABL" 

and likewise:

If ( Table::Type1 = "ABL" and ( Table::Type2 = "XA" or Table::Type2 = "YA" or Table::Type2 = "ZA") ; Table::ID ; 0 )

should be:

Table::Type1 = "ABL" and ( Table::Type2 = "XA" or Table::Type2 = "YA" or Table::Type2 = "ZA" ) 

 

  • Author

As always Comment, you're absolutely right. I removed the IF and left just the name of the first field I want to filter:

Table::Type1 = "ABL"

and it worked nicely.

Yet, the second part:

Table::Type1 = "ABL" and ( Table::Type2 = "XA" or Table::Type2 = "YA" or Table::Type2 = "ZA" ) 

still retrieves blank records mixed with the expected records.  Probably that's why I got muddied up with the If statement.

Best,

Daniel

1 hour ago, Quito said:

still retrieves blank records mixed with the expected records.

As I said, this is not the likely cause. I don't know what the real cause is, and I am having trouble visualizing the situation you describe. That's why I suggested you post a demo file. 

 

  • Author

Thank you Comment,

After your last post I decided to make a copy of the file and remove some things that weren't necessary for the demo and the problem went away.

- Still scratching my head

Update: I think one of the tables in the Portal was extending beyond the Portal layout

Edited by Quito

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.