Link to home
Start Free TrialLog in
Avatar of 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"
Avatar of daj_uk
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jforget1


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.
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

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.
@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.
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?
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.
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.
Been' there ;-)