Help w/formula

Can someone let me know what is wrong with this hide/when formula:

Mgr = “0” | @IsDocBeingEdited & !@Contains(@UserRoles;“[ADM]”)

What I am trying to achieve is having a particluar field hidden if the Mgr field returns the value 0, or if the document is being edited and the user does not have the ADM role.

Is there another way to accomplish the same thing?

Subject: Help w/formula

Do you mean

Mgr=“”?

try this:

Mgr = “” | (@IsDocBeingEdited & !@Contains(@UserRoles;“[ADM]”))

Subject: RE: Help w/formula

Or maybe he means Mgr = 0 – without the quotes.

I agree with Robert about the performance considerations for @UserRoles. In addition, note that it’s wasteful to use @Contains here; “=” will do what you want without wasting time searching for substrings.

Subject: RE: Help w/formula

It all falls under the “Depends on the Situation” thing.

Subject: Help w/formula

Or, for what it’s worth, you could always do the following:

(Mgr = “0”) |

(@IsDocBeingEdited & @IsNotMember(“[ADM]”;@UserRoles))

That’s what I use but shouldn’t matter either way.

Subject: RE: Help w/formula

Thank you all for your suggestions. It was only one field that needed to be hidden so I went with the last suggestion. I still had an issue getting it work correctly until I found this posting but all is well now after adding a space before the field. I think I may have neglected to mention that the particular field was a rich text field.

http://www-1.ibm.com/support/docview.wss?rs=203&q=158231&uid=sim2cb55fe3b8eb0a14e85256cc200635204&loc=en_US&cs=utf-8&lang=en+en

Thanks again.

Subject: Help w/formula

I always put my hide-whens on separate lines to make them easier to read. In your case, it would look like this:

Mgr=“0” |

(@isdocbeingedited & !@contains(@userroles;“[ADM]”))

Notice that the second line has an extra set of parenthesis because that line is to be evaluated separately from the first. I think that is what you are missing.

Also, a side note - @userroles has an impact on performance - especially when they’re used in multiple fields for hide whens. I’d recommend adding a computed field at the top, URoles, to calc the @userroles, and then reference this field in your hide when formulas. Note, however, that this is only for fields, not action buttons or subforms.

hth

Bob