?
Solved

Help with a complicated hidewhen formula usinng many userroles

Posted on 2003-03-27
12
Medium Priority
?
482 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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