LDD Today

Tips from LDD

Simplifying hide-whens with @True and @False formulas

Tip submitted by
Mataprasad Agralwal

Level: Intermediate
Works with: Notes/Domoino
Updated: 03-Mar-2002

Using a specific example, this tip shows how to use @True and @False to simplify hide-when formulas that include more than one AND/OR conditions.

Our example includes two parts:

In the first part of our example, we want to know whether or not the user is a member of a group allowed to approve documents. If so, then we want to show certain action buttons on a document to allow the user to approve the document. Add the following code to your form's action button hide-when formula:

var:=@If(@Ismember(@UserName;EditorsList) & FieldStatus="Approve";@True; @False);
var1:=@IF(OtherApproversComment !="" & @IsAvailable(RTF);@False;@True);
var2:=@IF(Approval="Yes" & SomeFlag="NO";@False;@True);

The condition is met if both var and var1 are true or if var2 is true. On the hide-when tab of the Action Properties box, add the following code:

@IF((var & var1) | var2;@False;@True);

Next, we want to tailor our view selection formula to evaluate to show only approved documents. Again, the condition for displaying the document in a view is met if both var and var1 are true or if var2 is true. Enter the following code in the view selection formula:

var:=@If(@Ismember(@UserName;EditorsList)AND FieldStatus="Approve";@True;
@False);
var1:=@IF(OtherApproversComment !="" AND @IsAvailable(RTF);@False;@True);
var2:=@IF(Approval="Yes" AND SomeFlag="NO";@False;@True);
var3 := @IF((var & var1) | var2;@True;@False);
Select (Form="This" | Form="That") & var3

This code filters the view documents like search parameters.


SUBMIT YOUR TIPS!
We encourage you to send us your tips (You can also click the "Would you like to submit a tip?" graphic below.) Your tips can be anything you've discovered about any Lotus product. The most important thing is that your tip be interesting, useful, or handy. And be sure to include complete information about how your tip works. For ideas, take a look at our tip archives. If we publish your tip, we'll send you the IBM Redbooks Lotus Collection on CD.