Hi @JasonMark
Thanks for the update on this.
Abs (
Abs(
$$View_Private - 1 )
*
(Join::IsPrivate )
-1
)
I would like to humbly offer a few alternatives to the calculation that you have posted above.
It may be that the above (what I might refer to as an "arithmetic" style of implementing the logic) works well for you, that is to say is easy to read and understand.
For myself, I find it a little easier to read a version which uses some of the FMP logical operators. I will include some ideas below, in case it is of interest.
Version 1: Literally rewrite the arithmetic version using logical operators:
not(
not $$View_Private
and
Join::IsPrivate
)
Version 2: Simplify by avoiding the outer negation:
$$View_Private
or
not Join::IsPrivate
Version 3: Use a Case statement:
Case(
$$View_Private ; True ;
Join::IsPrivate ; False ;
True
)
Assuming that $$View_Private and Join::IsPrivate are only set to values of either 0, 1, or "", then the above variations will produce the same results as your original calculation.
I'll note that while I might use a Case statement (version 3) for scenarios with more variations of outcomes and possibilities, in this particular case, I personally find Version 2 to be the most readable.
Also: If any of this "readability" topic feels of interest, I highly recommend checking out a recording of any presentation that @Bobino has given which covers the topic of how to write readable and maintainable code. A link to one such recording is here.
Last topic:
I downloaded your sample file (thanks for posting).
My suggestion would be to get into the habit of using the Refresh Portal script step to refresh your portals, and not the Refresh Window with the flush cache options enabled. In the short term, it may not matter much, and Refresh Window might even seem more convenient because it does not require you to name your portal layout objects, but, should you ever find yourself working on larger solutions with lots of record data, you may find that flushing the cache is an action which should not be taken lightly, as it may result in users having to re-download record data which they otherwise would have had available to them in their cache -- meaning, it can translate to a performance penalty if used unnecessarily.
Hope all of the above may help & kind regards.