?
Solved

Opinions & Help w/Complicated EditRights formula

Posted on 2003-02-26
13
Medium Priority
?
244 Views
Last Modified: 2013-12-18
Hello All

I am working on a editrights field

The following works;
@Unique (@Trim ( "[PDIADMIN]" :"[Coordinator]":@If (FormStatus = "NEW" | FormStatus = "DRA" ;

RequesterName ; FormStatus = "MAN" ;author:reviewer; FormStatus = "REV" ; RequesterName: Author :

RevrName:Coordinator ; FormStatus = "APP" ; RequesterName: Author : ApprName; FormStatus = "DFT"

;RequesterName: Author : LDrafter: ADrafter ; FormStatus = "DFT2" ;LDrafter : ADrafter ; FormStatus =

"RAP";RequesterName: Author : Coordinator; FormStatus =

"WREV":"AREJ":"DAP":"AREV":"RREJ";RequesterName: Author ;FormStatus = "OMIS" ; "[OMIS]" : Author

;FormStatus = "DRW" ; Author : Coordinator ; FormStatus= "CLO"; "NoAccess" ; "NoAccess")))




I have three fields (approver_4, approver_5, approver_6)that need to be added on the form where all

three could = None, two could contain info or one could contain info.

Based on the value of these fields Roles would be assigned.

FormStatus is set depending on the where the document is in the workflow(see above)


All three fields  would be using the sames Roles list.Is there a better way to construct this formula
other than adding what I have below to the above editrights formula

FormStatus = "APP" & approver_4 = "Assembly-Engine"; "[AE1]" : FormStatus = "APP" & approver_4 =

"Assembly-Rotor"; "[AR1]" : FormStatus = "APP"& approver_4 = "Forming-Component-1"; "[FC1]" :

FormStatus = "APP"& approver_4 = "Forming-Component-2"; "[FC2]" : FormStatus = "APP"& approver_4 =

"Forming-Combustion"; "[FC3]" : FormStatus = "APP"& approver_4 = "Forming-Blades&Vanes"; "[FB1]" :
FormStatus = "APP"& approver_4 = "Forming-Details-1"; "[FD1]" : FormStatus = "APP"& approver_4 =

"Forming-Diaphragm-2"; "[FD2]" :

FormStatus = "APP" & approver_5 = "Assembly-Engine"; "[AE1]" : FormStatus = "APP" & approver_5 =

"Assembly-Rotor"; "[AR1]" : FormStatus = "APP"& approver_5 = "Forming-Component-1"; "[FC1]" :

FormStatus = "APP"& approver_5 = "Forming-Component-2"; "[FC2]" : FormStatus = "APP"& approver_5 =

"Forming-Combustion"; "[FC3]" : FormStatus = "APP"& approver_5 = "Forming-Blades&Vanes"; "[FB1]" :
FormStatus = "APP"& approver_5 = "Forming-Details-1"; "[FD1]" : FormStatus = "APP"& approver_5 =

"Forming-Diaphragm-2"; "[FD2]" :

FormStatus = "APP" & approver_6 = "Assembly-Engine"; "[AE1]" : FormStatus = "APP" & approver_6 =

"Assembly-Rotor"; "[AR1]" : FormStatus = "APP"& approver_6 = "Forming-Component-1"; "[FC1]" :

FormStatus = "APP"& approver_6 = "Forming-Component-2"; "[FC2]" : FormStatus = "APP"& approver_6 =

"Forming-Combustion"; "[FC3]" : FormStatus = "APP"& approver_6 = "Forming-Blades&Vanes"; "[FB1]" :
FormStatus = "APP"& approver_6 = "Forming-Details-1"; "[FD1]" : FormStatus = "APP"& approver_6 =

"Forming-Diaphragm-2"; "[FD2]" ;


TIA

James E Wood
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
  • 4
  • 3
  • 2
  • +4
13 Comments
 
LVL 5

Expert Comment

by:AndrewJayPollack
ID: 8027439
well James, forgive me, I don't have the time to break down that huge formula right now and attempt to re write it.  What I would do, if it were me, is break it from one giant complex test into a bunch of seperate tests.

e.g.

name1 := @If( condition ; "NameValue" ; "");
name2 := @If( condition ; "NameValue" ; "");
...
name100 := @If( condition ; "NameValue" ; "");

then, you have a list of valid names, interspursed with "" null strings.   Use @Trim to get rid of the null strings, and you have your list.

final := @Trim(name1: name2: ... :name100);

the good part of this is you can quickly see and change the consditions for any specific name in your list.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 8027628
It can also be written like this

@if(FormStatus = "APP"; ""; @Return(0));

@if(approver_4 = "Assembly-Engine" | approver_5 = "Assembly-Engine" | approver_6 = "Assembly-Engine" ; "[AE1]"; ""):
@if(approver_4 = "Assembly-Rotor" | approver_5 = "Assembly-Rotor" | approver_6 = "Assembly-Rotor"; "[AR1]"; "") :
@if(approver_4 = "Forming-Component-1" | approver_5 = "Forming-Component-1"| approver_6 = "Forming-Component-1"; "[FC1]"; "") :
@if(approver_4 = "Forming-Component-2"| approver_5 = "Forming-Component-2" | approver_6 = "Forming-Component-2"; "[FC2]"; "") :
@If(approver_4 = "Forming-Combustion"| approver_5 = "Forming-Combustion"| approver_6 = "Forming-Combustion"; "[FC3]";"") :
@if(approver_4 = "Forming-Blades&Vanes"|approver_5 = "Forming-Blades&Vanes"|approver_6 = "Forming-Blades&Vanes"; "[FB1]"; "") :
@if(approver_4 = "Forming-Details-1"|approver_5 = "Forming-Details-1"|approver_6 = "Forming-Details-1"; "[FD1]"; "") :
@if(approver_4 = "Forming-Diaphragm-2"|approver_5 = "Forming-Diaphragm-2"|approver_6 = "Forming-Diaphragm-2"; "[FD2]"; "")

~Hemanth
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 800 total points
ID: 8027652
And elegantly like this
@if(FormStatus = "APP"; ""; @Return(0));

@if(@IsMember("Assembly-Engine" ;approver_4:approver_5:approver_6) ; "[AE1]"; ""):
@if(@IsMember("Assembly-Rotor" ;approver_4:approver_5:approver_6); "[AR1]"; "") :
@if(@IsMember("Forming-Component-1" ;approver_4:approver_5:approver_6); "[FC1]"; "") :
@if(@IsMember("Forming-Component-2" ;approver_4:approver_5:approver_6); "[FC2]"; "") :
@If(@IsMember("Forming-Combustion" ;approver_4:approver_5:approver_6); "[FC3]";"") :
@if(@IsMember("Forming-Blades&Vanes";approver_4:approver_5:approver_6); "[FB1]"; "") :
@if(@IsMember("Forming-Details-1";approver_4:approver_5:approver_6); "[FD1]"; "") :
@if(@IsMember("Forming-Diaphragm-2";approver_4:approver_5:approver_6); "[FD2]"; "")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:CRAK
ID: 8027763
If I have copied bits of your code correctly, and haven't overread anything, It is possible.
The basis for approver_4, approver_5 and approver_6 is always the same: they (can) contain the same approvers and always get translated to the same roles.
You could simplify it into:

ApprLst :=
   "Assembly-Engine" :
   "Assembly-Rotor" :
   "Forming-Component-1" :
   "Forming-Component-2" :
   "Forming-Combustion" :
   "Forming-Blades&Vanes" :
   "Forming-Details-1" :
   "Forming-Diaphragm-2";

RoleLst :=
   "[AE1]" :
   "[AR1]" :
   "[FC1]" :
   "[FC2]" :
   "[FC3]" :
   "[FB1]" :
   "[FD1]" :
   "[FD2]";

App4 :=
   @Replace(
      approver_4;
      ApprLst;
      RoleLst
      );
     
App5 :=
   @Replace(
      approver_5;
      ApprLst;
      RoleLst
      );

App6 :=
   @Replace(
      approver_6;
      ApprLst;
      RoleLst
      );

@If(
   FormStatus = "APP";
   @Unique(@Trim(App4 : App5 : App6));
   ""
   )

Beware that ApprLst and RoleLst form a 1:1 list!
0
 
LVL 13

Expert Comment

by:CRAK
ID: 8027784
That's because I don't like redundancies....

And to improve that, forget about App4, App5 and App6:

App:=
  @Replace(
     approver_4 : approver_5 : approver_6;
     ApprLst;
     RoleLst
     );
0
 
LVL 1

Expert Comment

by:burmontpoint
ID: 8028403
Add this line before your other @Unique:
approvers:= @Unique (@Trim ( approver_4 : approver_5 : approver_6));
This will combine the values for those approver fields into one field to test.
Now add this to the end of your existing if statement:

FormStatus = "APP" ;
  IF( @contains (approvers; "Assembly-Engine"); "[AE1]" ;
    @contains (approvers; "Assembly-Rotor"); "[AR1]";
    @contains (approvers; "Forming-Component-1"); "[FC1]" ;
    @contains (approvers; "Forming-Component-2"; "[FC2]" ;
    @contains (approvers; "Forming-Combustion"); "[FC3]" ;
    @contains (approvers; "Forming-Blades&Vanes"; "[FB1]" ;
    @contains (approvers; "Forming-Details-1"); "[FD1]" ;
    @contains (approvers; "Forming-Diaphragm-2"); "[FD2]" ;
  "");
"")


0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 8028898
This is interesting...
0
 

Author Comment

by:imjamesw
ID: 8030603
I have to say this has generated some excellent ideas. I am evaluating a few of them. Thanks to all who participated. This seem to be the great thing about Notes, so many ways to reach a goal.

Best Regards

James
0
 
LVL 13

Expert Comment

by:CRAK
ID: 8031785
....and we haven't even discussed any lotusscript ways yet!
;-))
0
 

Author Comment

by:imjamesw
ID: 8033406
That had occured to me

Another variation is I would like to be able to use something like the above in a Hidewhen for a button
Each approver have their own accept button that is visible only under certain statuses of the form and only to the person listed in the approver_* field.
Something like
StatusRev != "Complete" | StatusD != "Drafting Complete" | (@IsNotMember(@Name([CN]; @UserName); Approver_3)) |  AppStat_3 = "Approval Completed"

What I need it to is to only show to the correct role
so if the approver field contains Assembly-Engine then AE1 etc...

James
0
 
LVL 13

Expert Comment

by:CRAK
ID: 8034009
I don't think I have a complete image of the full scale problem here.
Does it help if I say that I would compare the approvers field with @UserNamesList to start with? It would save you checking a lot of roles groups and the username separately.
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 8034779
Here is an idea that may help.

-------
Name: * Venkatesh Padmanabhan
 
Code Title: * Hide Formulas Optimization
 
Description: *
Suppose you have say some 50 fields in your form and they can be
grouped. Say some 10 fields should be visible under a particular
condition, another 7 and some other condition etc....
Instead writing the entire code directly in the individual fields,
we can create some computed hidden fields and write the Hide
formula there. These fields will contain either 1 or 0. Now use this fieldname in the hideformulas. This is a very
efficient way of writing a Hide formulas.
Suppose if the Hide formula has to be changes then it can
be changed at a single place. If Hide formulas contain complex
formulas like @DbLookup then instead of doing a Lookup on all
the fields which contain these Hide formulas, this (Dblookup)
will be calculated only once.

I hope this helps.

--------------------
0
 

Author Comment

by:imjamesw
ID: 8035418
Thanx Again

You were right there were some excellent ideas

James
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

764 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