could not edit my previous post.I found out how I can make it work, sort of.
If I change the filter, the portal is not updated even if I add Refresh Object.But when I close the Layout, just before the Layout vanishes, the portal displays the records. And when I reopen the layout, the records are still displayed... even though the global fields the filter depends on are set to "".
The plot thickens...
You probably need to commit the record for the filtering to work. A script trigger after changing the values in the global fields should do it
If I change the filter, the portal is not updated even if I add Refresh Object.But when I close the Layout, just before the Layout vanishes, the portal displays the records.
IMO, Refresh Object doesn't work very reliably (or I don't understand its functionality).
You should get an updated display by using Commit Record, and then either Refresh Window [ Flash Cached Join Results ], or by resetting one of the key fields (on the layout side) of the portal relationship to itself; that will force an update only for the relationships that field is used in.
To answer your thread title: A portal filter is a calculation, which means you can inherently use any function and syntactically valid construct to calculate your (Boolean) result.
you were both right, a commit was needed.
It may be worth noting that while you can use "if" here (along with any other functions) you will probably find that it's not necessary when you're trying to calculated a Boolean result.
For conditional formatting, the function correlates to the condition parameter of an if statement, with the formatting being the "result if true".