Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help with a complicated hidewhen formula usinng many userroles

Posted on 2003-03-27
12
Medium Priority
?
494 Views
Last Modified: 2013-12-18
Hello All


I need help with a complicated hidewhen


In a database there is an approval section in a table.. Within the section there are up to ten

different approvers and ten rows in the table.

Each of the rows has an Accept or Deny button. The hidewhen on the buttons is based on the name in a

field.......

StatusRev != "Complete" | StatusD != "Drafting Complete" | (@IsNotMember(@Name([CN]; @UserName);

Approver)) | AppStat = "Approval Completed"

approver, approver_1 etc....

Three of the approver fields approver_4, approver_5 and approver_6  contain group names.

Each group has a userrole created for it. I only want to show the button to individuals from that

group. I know that it will be available to all members of the group, however with the security on the

form only one person will be able to edit the document and push the button which when pushed will

disapperar.

examples of the groups and roles

Assembly_Engine             AE1
Assembly_Rotor              AR1
Forming                     FC1

etc...

This is the current hidewhen. The userrole  MQ has been assigned to all groups, problem is they can

see buttons they are not supposed to, I only want the right role seeing the right button. If the

person from a group with AE1 enters the document they will only see the button for Assembly-Engine.


@TextToNumber(MaximumApprovers) < 5 | StatusRev != "Complete" | StatusD != "Drafting Complete"

|(@IsNotMember(@Name([CN]; @UserRoles);  "[MQ]" )) | AppStat_4 = "Approval Completed"

Any help is appreciated

Regards

James
0
Comment
Question by:imjamesw
  • 7
  • 5
12 Comments
 

Author Comment

by:imjamesw
ID: 8218501
Here is what I have so far
@TextToNumber(MaximumApprovers) < 5 | StatusRev != "Complete" | StatusD != "Drafting Complete" |approver_4 =
"Assembly-Engine";@IsNotMember("[AE1]";@UserRoles):
"Assembly_Rotor";@IsNotMember("[AR1]"; @UserRoles):
"Forming-Components-1";@IsNotMember("[FC1]"; @UserRoles):
"Forming-Components-2";@IsNotMember("[FC2]"; @UserRoles):
"Forming-Combustion"  ;@IsNotMember("[FC3]"; @UserRoles):
"Forming-Details-1"   ;@IsNotMember("[FD1]"; @UserRoles):
"Forming-Diaphragms-2";@IsNotMember("[FD2]"; @UserRoles):
"Forming-Blades&Vanes";@IsNotMember("[FB1]"; @UserRoles) | AppStat_4 = "Approval Completed"
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8219308
First Hide the buttons for Read Mode.

@IsDocBeingEdited

Checks the current status of the document and returns 1 (True) if the document is being edited; otherwise returns 0 (False).

Then Add the role to the buttons hide when

eg: For AE1

!@IsDocBeingEdited | @IsNOTMember("[AE1]";@UserRoles)

~Hemanth
0
 

Author Comment

by:imjamesw
ID: 8219532
That does not work for me
I need to isolate approver_4,approver_5 and approver_6

If I just base the hidewhens on the role the buttons show up for all three approvers, I need it for only the person that is editing and just for their particular function.

It could be any of the eight groups I have described in any of the approver fields,

Assembly-Engine, Assembly-Rotor etc..

James
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:imjamesw
ID: 8219533
That does not work for me
I need to isolate approver_4,approver_5 and approver_6

If I just base the hidewhens on the role the buttons show up for all three approvers, I need it for only the person that is editing and just for their particular function.

It could be any of the eight groups I have described in any of the approver fields,

Assembly-Engine, Assembly-Rotor etc..

James
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8220578
Let me rephrase your requirement. THere are 10 rows of accept/deny buttons. And each row represent a groups activity ... RIGHT !

If so then use @UserNamesList which will say which group he is in and hide it to that group.


0
 

Author Comment

by:imjamesw
ID: 8220608
Is that available im 4.6
0
 

Author Comment

by:imjamesw
ID: 8220617
Is that available im 4.6
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8220625
Nope, It is new in R5.
0
 

Author Comment

by:imjamesw
ID: 8222306
Well I am having to develop this in 4.64. Do you have any other ideas.

James
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8226051
I would suggest two soln here. Pick one

1. Let the buttons be visible to everyone. When he/she clicks the button. Then query his/her name against the NAB and see which group he belongs to and then allow executing the function or raise an error accordingly.

2. Create a field called BelongsTo. And in postopen query the NAB and get the group that he belongs to. Fill this field and then use it in HIde-when for the field.

Let me see if I have the code which does this.
0
 

Author Comment

by:imjamesw
ID: 8227496
Hi There

Thanks for you help

I came up with the following as a solution for the three group rows.

It works quite nicely. However if you have a cleaner way of achieing the same results, I would be interested.

James

@TextToNumber(MaximumApprovers) < 5 | StatusRev != "Complete" | StatusD != "Drafting Complete"|

(@IsNotMember(@Name([CN]; @UserName); Approver_4 )) |

(@IsNotMember("[AE1]"; @UserRoles) & @Contains(approver_4 ; "Assembly-Engine")) :
(@IsNotMember("[AR1]"; @UserRoles) & @Contains(approver_4 ; "Assembly-Rotor")) :
(@IsNotMember("[FC1]"; @UserRoles) & @Contains(approver_4 ; "Forming-Components-1")) :
(@IsNotMember("[FC2]"; @UserRoles) & @Contains(approver_4 ; "Forming-Components-2")) :
(@IsNotMember("[FC3]"; @UserRoles) & @Contains(approver_4 ; "Forming-Combustion")) :
(@IsNotMember("[FD1]"; @UserRoles) & @Contains(approver_4 ; "Forming-Details-1")) :
(@IsNotMember("[FD2]"; @UserRoles) & @Contains(approver_4 ; "Forming-Diaphragms-2")) :
(@IsNotMember("[FB1]"; @UserRoles) & @Contains(approver_4 ; "Forming-Blades&Vanes"))

| AppStat_4 = "Approval Completed"
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 1000 total points
ID: 8228209
As I suggested in previous comment.

Create a field called BelongsTo (Multivalued).

In postopen event, Call this script

Dim session as New NOtesSession
Source.Document.BelongsTo = GetGroups( session.UserName )

In the globals declaration (or in script library) Include this function

Function GetGroups(new_name As String) As Variant
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim Names_db As NotesDatabase
     Dim Names_view As NotesView
     Dim Names_dc As NotesDocumentCollection
     Dim Names_doc As NotesDocument
     Dim Names_item As NotesItem
     Dim Names_List List As String
     Dim Name_name As NotesName
     Dim CRLF As String
     CRLF = Chr$(10) & Chr$(13)
     Set db = session.currentDatabase
'     Set Names_db = New NotesDatabase(db.Server,"names.nsf")
     Set Names_db = New NotesDatabase("PSGUSRTP","names.nsf")
     Set Names_view = Names_db.GetView("Groups")    
     Set Name_name = New NotesName(new_name$)
     new_name2$ = Name_name.Canonical
     search_formula$ = "(@ISMember(""" & new_name2$ & """; Members) | @ISmember(""" & new_name$ & """ ; Members)) & (Form = ""Group"")"
     Set Names_dc  = Names_db.Search(search_formula$,Nothing,0)
     Set Names_doc = Names_dc.GetFirstDocument
     
     While Not Names_doc Is Nothing
          If Isempty(GetGroups) Then
               GetGroups = Names_doc.ListName
          Else
               GetGroups = Arrayappend(GetGroups, Names_doc.ListName)
          End If          
          Set Names_doc = Names_dc.GetNextDocument(Names_doc)
     Wend    
End Function


BelongsTO will contain all the groups that user is listed. Then use @ismember("Assembly-Engine"; BelongsTo) in your formula to hide/show the buttons

~Hemanth
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question