Computed Subform Problem

Hi There,

I have tried both of these, but they don’t display the tab.

@If(@IsNotMember(“[HR]”:“[IT]”;@UserRoles)|TypeAdmin!=@Trim(@Name([CN];@UserName));“”;“Leave”)

and

@If(@IsNotMember(“[HR]”:“[IT]”;@UserRoles)|!@Contains(TypeAdmin;@Trim(@Name([CN];@UserName)));“”;“Leave”)

If I take the conditions out about the TypeAdmin, it works. And I’ve checked, TypeAdmin does contain the UserName. What can I do? Only the TypeAdmins are allowed to see and edit that bit, except for HR and IT. But I can’t seem to hide it otherwise?

Thanks in advance.

Subject: Computed Subform Problem

make the TypeAdmin a common name as well:

@If(@IsNotMember(“[HR]”:“[IT]”;@UserRoles)|@Name([CN];TypeAdmin)!=@Trim(@Name([CN];@UserName));“”;“Leave”)

personally, I would break it out, like this:

me:=@Name([CN];@UserName);

ta:=@Name([CN];TypeAdmin);

@IsNotMember(“[HR]”:“[IT]”;@UserRoles)|me!=ta;“”;“Leave”

see if that works for you.

Subject: Computed Subform Problem

Using negatives in or statements can lead to one pulling one’s hair out! Just guessing that you want the person who either has the role or is the TypeAdmin to be able to see the tab.

Try:

hasRole := @IsMember(“[HR]”:“[IT]”;@UserRoles);

isAdmin := @If (@name([cn];TypeAdmin)=@Trim(@Name([CN];@UserName));@True;@False);

@If (hasRole | isAdmin; “Leave”; “”)

Subject: RE: Computed Subform Problem

Thanks, will give it a try.

The TypeAdmin is not part of the HR and IT Roles. But they also need to see it.

Subject: RE: Computed Subform Problem

I also wonder if @Trim does any good here. If you have common names with multiple blanks in your organization, @Trim would ONLY be appropriate, if it has been used in populating the TypeAdmin field as well. And even then I’d rather remove it from both formulas.

Also, when converting from @IsNotMember to @IsMember, watch out for the exact meanings:

@IsMember(“[HR]”:“[IT]”; @UserRoles)

Returns @True only, if the user has both, the [HR] AND the [IT] role. I assume, that this is not what you want.

@IsNotMember(“[HR”:“[IT]”; @UserRoles)

on the other hand returns @False only, if the user has neither the [HR] nor the [IT] role.

I second the advice to rather not use @IsNotMember, but you should rather replace it with

“[HR]”:“[IT]” *= @UserRoles

to keep the same meaning, as in your original example.

Subject: Computed Subform Problem