Using Hide When Formulas

Hide when formulas (also referred to as hide formulas) are available for objects including paragraphs, form actions, and view actions. Although you can find a Hide When tab on the properties box for fields, buttons , and hotspots, because these objects exist in a paragraph, any entry in that tab applies to the entire paragraph. Hide when formulas can be written only with the Formula language; they can range from the very simple formula @IsNewDoc , which hides the object when the document is new, to formulas that are very complex.

NOTE

Many hide options are available that do not require the use of the Formula language. The Hide tab of the properties box for each object has a number of check boxes, such as Hide from Web Browsers, Previewed for Reading, and Opened for Editing.

 

TIP

To conditionally hide or display objects, such as fields, on the same line in a form, create a table with the appropriate number of cells for each object. Place each object in its own cell and write the hide formula. Each cell in a table is treated as a paragraph.

 

To write a hide when formula, click the Hide When tab of the object properties box. Figure 13.6 shows the Hide When tab for a paragraph. Next, click Hide Paragraph (or Action) If Formula Is True, and enter a formula. You can combine these formulas with other hide attributes such as Previewed for Reading. When you enter a formula, if the result evaluates to true , the paragraph or action is hidden. For example, if you want to hide an action when the document is new, include this formula:

@IsNewDoc

Figure 13.6. The Hide tab for a paragraph ”note that in reality, a hide when formula applies to the entire paragraph.

graphics/13fig06.jpg

If you want to display a check box stating Resigned on the same row as some other information and have it display when the actual value is Resigned , check Hide Paragraph If Formula Is True and include a formula such as the following:

cResigned != "Resigned"

The effect of this formula is to hide the field if it does not equal Resigned and to display it if the value is Resigned .

Another typical use for hide formulas is to hide actions based on roles assigned to users. If only administrators should access a button, create a role called Admin and use a formula such as the following:

!@Contains(@UserRoles; "Admin")

Of course, you can combine this with other values. For example, you can create an action button that enables an application administrator to change the status of a document. You might not want anyone outside of the Admin role to use this button, and you also might not want the button displayed when the document is new. The following formula accomplishes this:

@IsNewDoc !@Contains(@UserRoles; "Admin")

Hide when formulas can be tricky when you combine multiple expressions. The previous line is a good example. You have to do a bit of Boolean algebra to make sure that you have the formulas evaluating to the right result ”remember that a is False , and a 1 is True for the Formula language. For an action or anything else to be hidden, the formula you enter must evaluate to True ( 1 ). When you use OR to connect the expressions, if any of the conditions evaluates to True , the expression is True . If you use AND to connect the expressions, all of the expressions must evaluate to True . If even one evaluates to False , the whole formula is False .

If you are having difficulty with the hide when formula results, you can create an action and use an @Prompt() formula to display the results, as in the following formula:

REM {jnResult stores the results of the Hide When formula}; 
REM {in the Formula Language, 0 is False, 1 is True};

jnResult := @IsNewDoc !@Contains(@UserRoles; "Admin");

REM {Display the result in a Prompt box};
@Prompt([OK]; "Boolean Result"; "The result of the formula is: " + @If(jnResult; "True";
graphics/ccc.gif
"False"))

Once the formula consistently displays True under all conditions that you are evaluating, add it to the hide when formula box.

Part I. Introduction to Release 6

Whats New in Release 6?

The Release 6 Object Store

The Integrated Development Environment

Part II. Foundations of Application Design

Forms Design

Advanced Form Design

Designing Views

Using Shared Resources in Domino Applications

Using the Page Designer

Creating Outlines

Adding Framesets to Domino Applications

Automating Your Application with Agents

Part III. Programming Domino Applications

Using the Formula Language

Real-World Examples Using the Formula Language

Writing LotusScript for Domino Applications

Real-World LotusScript Examples

Writing JavaScript for Domino Applications

Real-World JavaScript Examples

Writing Java for Domino Applications

Real-World Java Examples

Enhancing Domino Applications for the Web

Part IV. Advanced Design Topics

Accessing Data with XML

Accessing Data with DECS and DCRs

Security and Domino Applications

Creating Workflow Applications

Analyzing Domino Applications

Part V. Appendices

Appendix A. HTML Reference

Appendix B. Domino URL Reference



Lotus Notes and Domino 6 Development
Lotus Notes and Domino 6 Development (2nd Edition)
ISBN: 0672325020
EAN: 2147483647
Year: 2005
Pages: 288

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net