×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Using Global variables in formulas

Using Global variables in formulas

Using Global variables in formulas

(OP)
What I am trying to do is determine if the user belongs to a group and then hide a button if they do. right now I have this code in my open query:

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
  Dim session As New NotesSession
  Set db = session.CurrentDatabase
  Set doc = db.CreateDocument
  isManager = Evaluate(|@IsMember(@UserName; @ExpandNameList("MSTPTOR01DS/SVR/MasterPrec":"names.nsf";"MP_Managers"))|, doc)
  result = isManager(0)
End Sub

At the end of this result is 1 if the user belongs to the MP_Manager group.

Now in the Hide when part of the button I try to use result but that fails. I have declared result as String in a script library and in the Globals declaration of the form I am using the script library. The problem now is using result in a formula.

RE: Using Global variables in formulas

Why don't you put your formula language

@IsMember(@UserName; @ExpandNameList("MSTPTOR01DS/SVR/MasterPrec":"names.nsf";"MP_Managers")

in the hide when formula of the button?

Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!

RE: Using Global variables in formulas

Very good suggestion indeed.
One other (similar) way of doing it would be to put a ComputedForDisplay field with the @ExpandNameList("MSTPTOR01DS/SVR/MasterPrec":"names.nsf";"MP_Managers") formula and just place a formula like @IsMember(@UserName;GroupNames).
Either way, hide/when formulas are much easier to use/debug when based on field values. The field value can be set via Query/PostOpen or other LScript, but it is best that the hide/when itself not be "aware" of it.
Same for Computed Subforms. You could put your button on a subform (without hide/when then), and use a computed subform formula like the above to load the subform or not.
The obvious inconvenience with that is that no refresh is going to bring in the subform once the page is loaded, whereas the hide/when will.

Your call.

Pascal.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close