Link to home
Start Free TrialLog in
Avatar of imjamesw
imjamesw

asked on

Help with a complicated hidewhen formula usinng many userroles

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
Avatar of imjamesw
imjamesw

ASKER

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"
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
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
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
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.


Is that available im 4.6
Is that available im 4.6
Nope, It is new in R5.
Well I am having to develop this in 4.64. Do you have any other ideas.

James
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.
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"
ASKER CERTIFIED SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial