Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Global variables in formulas

Status
Not open for further replies.

rrajarat

MIS
Oct 8, 2002
42
US
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.
 
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!
 
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
Code:
@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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top