My problem is that I have a form with names field. In this field, I select a group. In the same form, I have a button. this button must be visible only If user is in the group. Do you know what formula I must put in hide formula of my button ?
thanks
Subject: How about this?
Add the Group name to the ACL and give it a ROLE. Then use this formula for the button:
!@IsMember(“[Role Name]”; @UserRoles)
Subject: RE: How about this?
Maybe I’m not interpreting Eric’s post correctly but it seems to me that the group the user is selecting is not necessarily a part of the ACL.
If this is the case I would recommend something like:
create a field ‘IsInGroup’ computed for display.
Set button’s ‘hide-when’ formula to hide when IsInGroup = ‘0’
In the ‘IsInGroup’ formula do something like:
targetValue := theNamesField; (this is the name of the field where the user selected the name and/or group)
@IF(targetValue =“”; @return(“0”); “”);
@IF(@Name([cn];targetValue) = @Name([cn];@UserName); @return(“1”); “”);
theMembers := @dbLookup(“”:“”; ; “Groups”; targetVaue; “Members”);
theMembers_1:= @IF(@IsError(theMembers) | theMembers = “”; @return(“0”); @trim(@Unique(theMembers))); (
@IF(@IsMember(@Name([cn];@UserName); @Name([cn];theMembers); @return(“1”); “0”);
Ernest
Subject: Check if user is in group
maybe @usernameslist is what you are looking for.
Subject: RE: Check if user is in group
Thanks
Is it possible to compare 2 lists ? Because @UserNameList return list and my field can contain a list of groups ?
Thanks
Subject: RE: Check if user is in group
Use roles, as suggested by michael b, below.