Avatar of jforget1
jforget1
 asked on

Hide embedded view

Having trouble again with the hiding of an embedded view. I want the view only to be visible to users with the OFFICE role and only when the hide_user field does not contain "hide". I have tried every combination I can think of but can't get this one to work. I have tried the !(@IsMember("[OFFICE]";@UserRoles) method for each item, but I still always see the item. I have tried the | (or) option, but it will not work for me.

@IsNotMember("[OFFICE]";@UserRoles) & hide_user = "hide"
Lotus IBM

Avatar of undefined
Last Comment
olaraak

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
daj_uk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
jforget1

ASKER
Tried this code which is interesting, have never used an @IF in hide code before. But it does not want to work, I have tried the hide_user both with the hide value and empty and the view never hides. Strange, based on the logic shown this should work.
daj_uk

I assume you are using the database on a server, or locally with "Enforce a consistent Access Control List across all replicas" selected?

Otherwise User Roles do not work

jforget1

ASKER
This is on a server and I have the consistent ACL enforced as well. I just tried taking the OFFICE role off myself, which then does hide the view. For some reason that hide_user factor is not coming into play.
Your help has saved me hundreds of hours of internet surfing.
fblack61
olaraak

@if function is good to use in hide-when formulas, when we have several conditions to check.

If the database is on local machine, then it is like daj_uk wrote, the "Enforce a consistent Access Control List across all replicas" must be switched on in ACL of database, and even then the hide formulas are not working very well. Sometimes it is need to close Notes and re-open it to flush cache and get roles working.

Other place to check is field hide- is it populated correctly?

Sometimes is good to use computed text to see what's going on. Use the same formulas with @text() in computed text and see, if they get the expected values.
jforget1

ASKER
OK I have put the formula in a computed field just to see the value and no matter if the value in the hide_user field is Hide or not, I get a Zero as the value in the field. How can the value be the same for both?
jforget1

ASKER
OK right now I feel like a jackass and apologize for this one going on so long. The field is hide_users and not hide_user. When I started the code for the hide I dropped the S. Thanks to all for the help.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
olaraak

It suggests that problem is with role checking.

Test @IsMember("[OFFICE]";@UserRoles) at first and see, if it evaluates correctly to 1 when user has role OFFICE, and 0 when user has no role.

If this works perfectly, then test in another field just the value of field "hide". If it displays "hide" correctly, then it's OK with it.

After that, check both formulas together, like daj_uk suggested, and see if result evaluates to correct number: 1 or 0.
olaraak

Been' there ;-)