what's new with forms and views in domino 6 - uni...

40
What's new with forms and views in Domino 6 Presented by the Lotus Developer Domain http://www.lotus.com/ldd Table of Contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Introduction .............................................................. 2 2. The user interface ...................................................... 4 3. Working with forms..................................................... 8 4. Working with views..................................................... 20 5. New programming enhancements for views....................... 35 6. Wrap up .................................................................. 39 7. Feedback ................................................................ 40 What's new with forms and views in Domino 6 Page 1 of 40

Upload: lytuong

Post on 06-Mar-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

What's new with forms and views inDomino 6

Presented by the Lotus Developer Domain

http://www.lotus.com/ldd

Table of ContentsIf you're viewing this document online, you can click any of the topics below to link directly to that section.

1. Introduction.............................................................. 22. The user interface...................................................... 43. Working with forms..................................................... 84. Working with views..................................................... 205. New programming enhancements for views....................... 356. Wrap up.................................................................. 397. Feedback ................................................................ 40

What's new with forms and views in Domino 6 Page 1 of 40

Section 1. Introduction

What is this tutorial about?

A number of enhancements have been made in version 6 of Domino Designer. In thistutorial, we'll highlight what's new with forms and views. Whether you develop for Notesclients or for the Web, you'll learn how to use the new functionality to build bettercollaborative applications with less effort. We'll also show you how the DominoDesigner 6 user interface has changed and how you can customize it.

After completing this tutorial, you will know how to use many of the new features andfunctions available in Domino Designer 6. However, this tutorial will not covereverything that's new. For more comprehensive documentation, download the releasenotes for Lotus Notes/Domino 6.0.1 (see Resources on page 39 ).

Who should take this tutorial?

This tutorial will be useful for developers who work in an environment where LotusDomino version 5 or 4 is deployed, and who need to know some of the new featuresand functions available in Domino 6.

Required software

This tutorial guides you through what's new with forms and views in Domino 6. DominoDesigner is the tool for developing Domino databases. You should download and installDomino Designer 6. The latest release as of this writing is 6.0.1.

Lotus Notes 6 is an integrated collaborative client for messaging, calendaring, andscheduling, and for invoking the custom database applications you develop.

Lotus Domino 6 server provides a multiplatform foundation for collaborative e-businessapplications. Once you develop a Domino 6 database with Domino Designer, you needa Domino 6 server to host the application.

You can download trial versions of the required software at no charge. Note that one ofthe Notes Client trial downloads includes only the Notes Client, and the other includesDomino Designer and Admin.

About the authors

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 2 of 40 What's new with forms and views in Domino 6

Cindy Bailen

Cindy Bailen is a technology advocate with IBM Lotus Software, IBM Software Group,specializing in e-learning. Cindy has worked with Lotus technologies for more than tenyears. She has been a Certified Lotus Professional (CLP) and Certified Lotus Instructor(CLI) in both Lotus application development and system administration since LotusNotes 3. Cindy works on tutorials and Webcasts, and is moderator and contentmanager of the Lotus Masters Broadcast (http://www.lotus.com/masters). She appearsregularly on public television in Boston and throughout North America, hosting specialprograms for PBS. You can reach Cindy at [email protected].

George Brichacek

George Brichacek is a technology advocate with IBM Lotus Software, IBM SoftwareGroup, focused on application development and enterprise integration. He haspresented and developed several memorable demos for the Lotus Masters Broadcast,as well as for customers, and for internal field enablement. He works with Lotusproduct management to bring the latest and greatest technologies on Lotus applicationdevelopment and enterprise integration to you. During his spare time, he developedand supported a Lotus Notes utility called CalPrint. George resides in the Chicagoarea. He can be reached at [email protected].

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 3 of 40

Section 2. The user interface

Changes in the Domino Designer UI

Open Domino Designer 6 and you'll see some changes immediately. If you don'talways have the Domino object model posters at hand, the good news is that you cannow choose to display object models when you first open Domino Designer. You canselect Domino Objects for LotusScript and OLE, Domino Objects for DXL Support, orJavaScript Object Model.

Context-sensitive help is there for you when you click on an object. You can also viewquick links for common tasks. In the Design pane on the left of the UI, notice thatobjects are organized under their respective design elements (form, view, etc.), whichare expandable, making it easy to select the element you want to work on withouthaving to go to a view.

In Domino Designer 6, you'll find agents and actions under Shared Code. Additionalshared resources include files, stylesheets, and data connections. Non-nsf files cannow be stored inside a Domino database and shared among databases. CascadingStyle Sheets are created outside of Domino Designer, and can be used to control thelook and feel of forms, subforms, and pages, both within and among databases. Dataconnections let you use Domino to work with data residing in enterprise applications.Under Other are database resources, including Icon, the Using and About documents,and Database script; Navigators; and Design Synopsis.

Bookmark view

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 4 of 40 What's new with forms and views in Domino 6

Use the bookmark view for easy access to the applications and databases youfrequently use. You can drag and drop these items to the bookmark view. Thebookmark view has been enhanced visually so that it indicates the database with whichyou're working at any given time. The current database is white and all the otherdatabases are gray, as the figure below illustrates.

The new plus/minus icon can be used to expand or collapse the design elements in thebookmark view. In addition, scrolling is available when you have more than five designelements -- that is, more than five forms or views. Lastly, you can drag and drop adesign element from one database to another from the bookmark view.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 5 of 40

Customizing Domino Designer

You can start working with Domino Designer 6 by customizing it. As a developer, youmight have a favorite editor that you'd like to add to the tools Domino Designer 6provides. Now it's possible to launch and use third-party tools from inside DominoDesigner.

• From the menu, select Tools - Add Tool.

• Enter the name of the tool.

• Select Run Program to launch the tool from the menu. (Selecting Run Formula letsyou launch the tool from an @command.)

• In Tool Context, select one or more contexts in which you'd like the tool to beavailable.

• Click OK.

From now on, the tool will appear in the appropriate context on the Tools menu.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 6 of 40 What's new with forms and views in Domino 6

Once you add a tool, you can make it available in another context. In the CustomizeTools dialog, you can organize tools by dragging and dropping a tool into a differentmenu context, or by using the Cut, Copy, and Paste buttons.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 7 of 40

Section 3. Working with forms

Autocompletion

In Domino Designer 6, autocompletion is a type-ahead feature that makes it moreconvenient to use @functions and @commands, as well as HTML and LotusScriptclasses, properties, and methods. You can look up and paste these functions right intothe programmer's pane as you're entering your code. You'll even be given possibleparameters you can use.

Autocompletion is enabled by default. Use the Auto Complete tab on the programmer'spane properties box to change autocompletion settings.

Note that even if the options are disabled, you can still use the menu commands oraccelerator keys to display pop-up lists or boxes. To redisplay a list of options, you cando any of the following:

• Choose Edit - List Members from the menu

• Press Ctrl-Alt-T

• Type an at sign (@) when writing formula language code, if autocompletion isenabled

To redisplay a parameter box, if one is applicable in this situation, you can do either ofthe following:

• Choose Edit - Parameter Info from the menu

• Press Ctrl-Shift-Space

Autocomplete Programmer's pane

Creating reusable formulas

Domino Designer 6 has a number of new @functions. We'll make note here of a couplethat allow developers to create reusable translation and validation formulas:@ThisName, which returns the name of the current field, and @ThisValue, whichreturns the value of the current field. So, you can create an input translation formula in

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 8 of 40 What's new with forms and views in Domino 6

a field using @ThisValue; since you won't have hardcoded the field name, once youhave written the formula, it's available to copy and paste into other fields. Here'sanother convenience: Once you write code in Domino Designer 6, it's now possible toprint the contents of the programmer's pane, so you'll never again have to copy andpaste your code into an editor to print it.

Including field hints

In previous versions of Domino Designer, designers would sometimes create textpop-up hotspots to provide users with help on what to enter or select in a field. InDomino Designer 6, programmers now have an alternative: field hints. A field hint letsyou provide helpful text that the user sees the first time the field appears. This textdisappears when the user moves the cursor into the field, and is not stored in thedocument. This is not available for Web-based applications, only for those that use theNotes client.

To provide a field hint for a field:

• Click the Advanced tab on the Field Properties dialog

• Type in the field help you want

• Click the check to finalize it

• Save the form

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 9 of 40

Using a new field type

Domino Designer 6 gives us some new field types. In the past, when you used a RichText Field in an application, you might have been concerned about giving users leewayin terms of what they could put into the field (attachments, for example). Now, inDomino Designer 6, developers can place limitations on what a user can put in a field,using the new Rich Text Lite field type. This is not available for Web-basedapplications, only for those that use the Notes client.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 10 of 40 What's new with forms and views in Domino 6

Developers can specify the file types that users can enter in the Rich Text Lite field byselecting or deselecting one or more of the following:

• Pictures

• Shared Images

• Attachments

• Views

• DatePicker

• Shared Applets

• Text

• OLE Objects

• Calendar

• Inbox

• Help (to provide help on the different types of objects)

• Clear (to allow users to clear what they've put in the field)

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 11 of 40

Helper icon for Rich Text Lite

Rich Text Lite fields show a helper icon next to the field. When users click the icon,they get a faster way to add an object into the field. If the developer allows more thanone type of object in the field, a down arrow icon is also displayed. When the downarrow is clicked, a drop-down menu appears, showing the acceptable types of input.

Embedding elements

With Domino Designer 6, you can display embedded elements on a form, page,subform, or document. In an application used by both Notes clients and browser users,designing with embedded elements gives developers more control over the size andappearance of each element. Even if you're creating an application that will only beaccessed by Notes users, embedding elements can provide some design advantages,since you can use text, graphics, and other form elements along with the embeddedelement.

The following elements may be embedded:

• Views

• Folders

• Outlines

• Navigators

• DatePickers

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 12 of 40 What's new with forms and views in Domino 6

Embedding a view

To embed a view on a form to display response documents for the current document:

• Open a form.

• Choose Create - Embedded Element and select View.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 13 of 40

• On the Info tab, set the display option to Using Java Applet. In Web applications,displaying information via an applet rather than as HTML provides a more attractiveuser interface.

• On the Display tab, select Show Header, which will display view column titles.

• Select Show Only Current Thread to display the parent and response documents forthe current document.

You've now learned how to use autocompletion to help you write code, createdportable code with @ThisValue, printed your code from the programmer's pane, used aRich Text Lite field type, and embedded a view into a form. Next, we'll discuss somemore enhancements to forms using new Domino Designer features.

Using layers

You've long been able to use layers on the Web, and now you can use them in yourDomino applications too. Do you remember Layout Regions? Layers are a bigimprovement. Layers can be created in forms, pages, and subforms to give you morecontrol over placement, size, and content of information. They can make it easier todesign more complex forms, and easier to move a group of elements simultaneously.You can overlap layers, and even use multiple layers of layers. Color and images canbe used in stacked layers. Layers can have HTML properties. When you're workingwith layers, remember to deselect one layer before you select a different layer; if youdon't, you'll end up having both selected.

Layer properties

You can change the size and placement of a layer just by dragging it, but for more

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 14 of 40 What's new with forms and views in Domino 6

precision, right-click on a layer and specify its x and y coordinates in the LayerProperties dialog.

The Z-Index tells you the layer's relative position in a stack of layers, with 0 being thebottom. You can hide layers, making it possible to show different content to differentusers. To redisplay a layer that has been hidden, right-click its anchor and select ShowLayer from the menu.

Using color in fields

A color field lets you display a color picker on a form. When the user clicks the downarrow of a color field, a color chart appears with two tabs. The user can choose a colorusing either tab.

At the Notes/Web tab, the user can choose from a Lotus Notes color palette or a Webcolor palette. Note that the Notes tab becomes the Web tab only if the user hasenabled the use of the Web palette (under File - Preferences - User Preferences). TheRGB (red, green, blue) value appears at the bottom of the palette for each color. If youare using the Notes palette, the name of the color also appears.

At the RGB tab, the user can either enter values from 0 to 255 for red, green, and blue,or use the RGB sliding arrows to choose a value from 0 to 255. The mixed colorappears in the box to the right of the RGB values. The user can also use the colormatrix bars at the bottom of the pane to define a color.

The color picker can also be used to select any color on your screen. On the colorpicker's RGB tab, click and drag on either of the gradient bars, then click theeyedropper icon on anything you see on your monitor to pick up its color.

Note that the user must be running in a color mode greater than 256 color to see thereal color. If a user enters an RGB value not in the palette and the user is in 256-color

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 15 of 40

mode, then the closest color in the palette will be displayed for the RGB value. Thecorrect RGB value will be stored and will appear correctly on systems with greater than256 colors.

The chosen color is stored in RGB hexadecimal format.

Color in views

Later, we'll create a column in a view, setting a column property to use value as color,and writing a column formula that will evaluate to the appropriate color value. Thenwe'll be able to display the different row colors. (For more on this, see Adding colors toa view on page 33 .)

While we're on the subject of using color in views, the new Color field type deserves amention. It allows a user to select colors for displaying documents in a view. Notesusers select from a color picker; the values are then stored in RGB hexadecimalformat.

Web browser users don't see the color picker, but they can still enter an RGB value ina Color field to specify the color of their choice -- 00FF00 for green, for example.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 16 of 40 What's new with forms and views in Domino 6

Notes 6 mail template color picker

By now, you may have noticed that there are Color fields at work in at the Notes 6 mailtemplate, which allows mail from different senders to be displayed in different colors inthe inbox.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 17 of 40

Tabbed tables

Of course, tabbed tables were previously available to developers, with the tabsrepresenting table rows. In Domino Designer 6, there are some enhancements totabbed tables that allow developers to place tabs on the left, right, or bottom of thetable, in addition to the top (the default position). The first tab can now be indented. It isalso possible to make the tabs the same size, regardless of the number of characterson the labels.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 18 of 40 What's new with forms and views in Domino 6

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 19 of 40

Section 4. Working with views

Twisties

Views help users find the documents they want. A view is a sorted or categorized list ofdocuments. Views are the entry point to the data stored in a Domino database. Everydatabase must have at least one view. Views can be created by the database designeror by the end user, depending on the access control level.

There are several new enhancements to views in Domino Designer 6. This tutorialcovers just the major enhancements to views. For all the information about what's newwith views, refer to the Lotus Domino Designer 6 Help database.

The first design enhancement with version 6 is that it's now easier to change thetriangular icon that indicates that a row or a section may be expanded or collapsed.These icons are called twisties. While in Domino Designer and in a view that has acategorized column, double-click the column header to open the Properties dialog boxfor the column.

Notes Client Domino Designer

Change the twistie image

In this panel, we are going to change the twistie from the default image to a plus-minusimage. (You could theoretically use any other image you've created.) For your image tobe visible in a view, each image should be no wider than 6 pixels. The font size of thecolumn text determines how high your image should be. For a column with text that hasa font size of 10, each image should be no higher than 12 pixels.

Using a graphics program, create an image by importing two images into one graphic.One of the images will appear as the icon that expands a row or section, and the otherwill appear as the icon that collapses the row or section. Place the expand image onthe left and the collapse image on the right.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 20 of 40 What's new with forms and views in Domino 6

From the Column Properties dialog box for the first column, select the folder icon tobrowse images for the twistie image. Select the image and click OK. It's that easy now.Instead of the twistie, it's now a plus sign for a collapsed category and a minus sign foran expanded category.

Notes Client Domino Designer

Moving columns

Suppose you want to switch the last two columns in your view around. In the past, youhad to cut and paste the column. Now, in the example below, you would simply selectthe last column (Published), drag it before the Price column, and drop it there. That's allthere is to it!

Allow view customization

By default, a Notes client user can customize a view in a variety of ways, includingresizing and reordering columns or setting color options. Changes users make aremaintained when they close and reopen the view. If you do not want users tocustomize a view, deselect the Allow Customizations option on the Info tab. Note thatdeselecting the option does not disable the user menu option to customize the view. Itdoes, however, disable all the options within that dialog except for sorting, which isretained as an available item for accessibility purposes. Remember, the option tocustomize a view is enabled when you create a new view.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 21 of 40

Note: This feature is not supported for Web-based applications.

Notes client customize view options

From the Notes client, open a view, and select View - Customize This View.... The userhas several options to change the view. They can:

• Move columns up and down

• Make columns visible or not

• Change the width of a column

• Change the row spacing and lines per row

After all these changes, if the user decides to restore the view to the way it wasoriginally -- to the way you designed it, in other words -- the user can click the Defaultsbutton.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 22 of 40 What's new with forms and views in Domino 6

If the user simply wants to move columns around, they can do this right from the view.The user can select a column, drag it to another location, and then just drop it therewithout having to open the Customize View dialog box.

Locking views

In Lotus Domino Designer 6, not only can you share elements within a database, butyou can also share them across databases. Because access to design elements haswidened, Notes now lets you lock the elements you design. This prevents two or moreteam members from making changes to a particular element at the same time.

If you work on a team and want to ensure that other designers cannot modify designelements that you are working with, you can lock those elements explicitly. You canunlock them when you have finished working with the design elements and want torelease them so that others can modify them. A design element that is not explicitlylocked is always temporarily locked while it is being edited. The temporary lock isreleased after the designer has finished editing the design element.

The first step in enabling locking for design elements is to identify a master lock server,which is the administrator server. Display the access control list for the database andselect the Advanced tab. Select a Domino server for the master lock server from thedrop-down list.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 23 of 40

Allow design locking

You need to enable design element locking when you want the ability to lock andunlock any view in a database. This will also enable locking for all design elements inthe database. To do so:

1. Open the database

2. Choose File - Database - Properties and click the Design tab

3. Select Allow Design Locking

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 24 of 40 What's new with forms and views in Domino 6

To lock a view

As mentioned earlier, a temporary lock is always held when a view is opened forediting, and it is released when the designer has finished editing.

There are two ways to lock a view: from the Domino Designer client, andprogrammatically. To lock a view from Domino Designer, simply display a list of views,then select a view and right-click on it to lock or unlock it.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 25 of 40

There are also new methods to the NotesView class that can be used to lock andunlock a view using LotusScript. Here is an example of LotusScript that locks a view.

%INCLUDE "lsxbeerr.lss"

Sub Click(Source As Button)Dim session As New NotesSessionDim db As NotesDatabaseSet db = session.CurrentDatabase

REM Exit if locking is not enabledIf Not db.IsDesignLockingEnabled ThenPrint "Design locking not enabled"Exit Sub

End If

REM Get viewDim view As NotesViewSet view = db.GetView("Main View")

REM Lock the viewREM Not locked if return is False or error is raisedOn Error Goto errhIf view.Lock("Guys", True) ThenPrint "View locked - " & view.Name

ElsePrint "View NOT locked - " & view.Name

End IfExit Sub

errh:If Err() = lsERR_NOTES_LOCKED ThenPrint "View NOT locked - " & view.Name

ElseMessagebox "Error " & Err() & ": " & Error(),, "Error"

End If

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 26 of 40 What's new with forms and views in Domino 6

Exit SubEnd Sub

Creating documents at the view level

You can give Notes users the ability to edit fields in an existing document or create anew document from a view. You don't need to open a document to make changes oropen a form to create a new document; you can now do this from a view. In the nextfew panels, we will set up a view to edit documents and create new documents. Inaddition to enabling a specific option, you need to program the InViewEdit event for theview to specify what should happen when the Notes client user creates a document orchanges a value.

Note: This feature is not supported for Web-based applications.

Open a view in Domino Designer. Select the second tab, the Info options tab, in theview's properties dialog box and make sure Create new documents at view level isenabled.

InViewEdit event

That was the easy part. Now expand the view in the programmer's pane and, under theObjects tab, select the InViewEdit event. This event allows the user to edit or createdocuments through its view column entries.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 27 of 40

InViewEdit parameters

There are several parameters passed to the InViewEdit event. The first we will discussis the request type. The request type passed is an integer value. There are four requesttypes, and each has a corresponding integer value:

• Query: The value is 1 when the user enters an editable view column entry. Note: ForDomino Designer release 6.0, request 1 is reserved. It should not be used.

• Validate: The value is 2 when the user exits an editable view column entry.

• Save: The value is 3 after validation of one or more view column entries in anexisting document.

• New entry: The value is 4 after validation of one or more view column entries in anew document.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 28 of 40 What's new with forms and views in Domino 6

The next parameter passed is the column programmatic name. It's an array of typeString and is read only. For the query and validate requests, it's the programmaticname of the current column, in element 0. For the save and new entry requests, it's theprogrammatic names of the columns being processed, starting in element 0. If you givethe columns in the view the same names as the fields, it makes programming thisevent much simpler, as you will see in the example. You don't have to do this, but incoding this event you need to know the name of the column and correlate it to the field.

The next parameter passed is the column value. It's an array of type Variant. Theelements of this array correspond to those of the column programmatic name. For thequery and validate requests, it's the text of the current column entry, in element 0. Forthe save and new entry requests, it's the text of the column entries being processed,starting in element 0.

The last parameter we'll discuss is the continue value. It's a boolean value. It indicateswhether or not a query or validate request proceeds, and is initially set to true. Set thisparameter to false to stop processing and generate an error message. This parameterdoes not apply to save and new entry requests.

Here is just an example of what the InViewEdit event could look like.

Sub Inviewedit(Source As Notesuiview,Requesttype As Integer,Colprogname As Variant,Columnvalue As Variant,Continue As Variant)

%REMIn this view, the programmatic name of each editable columnis the same as the name of the field whose value it holds.All the fields for the editable columns are simple Text.Each editable column gets the same processing.%END REM

REM Define constants for request typesConst QUERY_REQUEST = 1Const VALIDATE_REQUEST = 2Const SAVE_REQUEST = 3Const NEWENTRY_REQUEST = 4

REM Define variablesDim db As NotesDatabaseDim doc As NotesDocumentDim caret As String

REM Get the CaretNoteID - exit if it does not point at a documentcaret = Source.CaretNoteIDIf caret = "0" Then Exit Sub

REM Get the current database and documentSet db = Source.View.ParentSet doc = db.GetDocumentByID(caret)

REM Select the request typeSelect Case Requesttype

Case QUERY_REQUESTREM Reserved - do not use in Release 6.0

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 29 of 40

Case VALIDATE_REQUESTREM Cause validation error if user tries to exit column with no value

If Fulltrim(Columnvalue(0)) = "" ThenMessagebox "You must enter a value",, "No value in column"Continue = False

End If

Case SAVE_REQUESTREM Write the edited column view entries back to the document

For i = 0 To Ubound(Colprogname) Step 1Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))

NextREM Save(force, createResponse, markRead)

Call doc.Save(True, True, True)

Case NEWENTRY_REQUESTREM Create document and create "Form" itemREM Write column values to the new document

Set doc = New NotesDocument(db)Call doc.ReplaceItemValue("Form", "BookForm")For i = 0 To Ubound(Colprogname) Step 1

Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))Next

REM Save(force, createResponse, markRead)Call doc.Save(True, True, True)

End SelectEnd Sub

Editable columns

Columns need to be enabled in order to be editable. Double-click each column header;this displays the properties dialog box for the column. Then check Editable column.

You can create one view so users can edit and create new documents. You can alsoset up multiple views to do this. For example, you can create a view for editing andanother for creating. Keep in mind that the view for creating should include all thecolumns for all the fields for which you need your end users to enter values.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 30 of 40 What's new with forms and views in Domino 6

Add a new document from a view

In the Notes client, end users will now see the message "Ctrl-Click here to add a newdocument" at the bottom of the view. If the user presses Ctrl and then clicks the lastline of the view, the first editable column will be enabled for input. The user enters avalue and presses the Tab key to go to the next editable column. When there are nomore editable columns, the user presses Enter and a new document is created. Thus,users don't have to display a form now to create new documents; they can do it from aview.

Also, by enabling these columns to be editable, users can change the values from theview, too. To change the values from the view, users simply need to select a row fromthe view, click a column value, then change the value.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 31 of 40

View style options

Most of the enhancements to views are on the third tab, Style. The first section of thetab, Body, lets you select a color for all the rows and for alternate rows. What's new isthe capability to add an image as a background to a view. You can repeat the imageonce, repeat it vertically, or repeat it horizontally. You can tile the image to cover theentire view, make the image stretch to fit the entire view, or just center the image in theview.

The Grid section of the tab lets you add different kinds of lines between rows in theview: solid, dashes, dots, or dashes and dots. Note that non-resizable columns andresponse-only columns do not display gridlines. Categorized views, views with flatheadings, and views with simple headings only display horizontal gridlines.

In the Rows section of the tab, select Don't show empty categories so that categorieswithout documents are not listed.

In the Other section of the tab, there are three selections.

• Show selection margin: Lets you show or not show the very first column in theview, which is the selection margin.

• Hide selection margin border: Lets you display or hide the vertical line between theselection margin and the first column in the view.

• Extend the last column to window width: Extends the last column to windowwidth. This isn't new in Designer 6, but it is in a new location in the Properties dialogbox.

The last section of the tab allows you set margins for the view. This is useful foroffsetting a view with a contrasting background color. Margin settings are not supportedfor Web-based applications.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 32 of 40 What's new with forms and views in Domino 6

Adding colors to a view

In Domino Designer 6, it's possible to change the color of a view column and all thecolumns to its right. This is done by selecting the column property Use value as color.To program colors, you can use hexadecimal values, such as FF0000, or RGB values,such as 255:00:00. If only one value is used, it specifies the text color. If two values areused, the first specifies the color of the background and the second specifies the colorof the text.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 33 of 40

The color values are used in the column formula, but we'll make the column hidden sousers don't see the color values in the view.

As an example, let's create a form with a color field called Priority. We'll reference thevalue in that field in a column formula as follows:

• Edit a view

• Add a column to the far left so that it is the first column of the view

• Select Use value as color on the Column Info tab

• Create the column formula@If(Priority="High";255:255:0:255:0:0;Recommendation="Low";0:0:255;"")

• On the Advanced tab, select Hide column

• Save the view

In this example, the view will show different row colors depending on the value in thePriority field. There are two RGB values given for "High" in the column formula: Thefirst value specifies the background color and the second value specifies the text color.The background of the row will be yellow (255:255:0), and the text color will be red(255:0:0). If the value in the priority field equals "Low," only the text color will beaffected. It will be changed to blue (0:0:255).

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 34 of 40 What's new with forms and views in Domino 6

Section 5. New programming enhancements for views

New @functions for views

There are two new @functions that deal with views: @GetViewInfo and @SetViewInfo.

@GetViewInfo returns a view attribute. The syntax is as follows:

@GetViewInfo ( [ attribute ] ; column )

Let's look at that in more detail:

• attribute: Must be enclosed in brackets. Use one of the following keywords forattributes:• [CalendarViewFormat]: Returns the number of days displayed: 1, 2, 5, 7, and

so on. Applies to calendar views only.

• [ColumnValue]: Returns the value of a column for the current row. Requires thesecond parameter.

• [IsCalViewTimeSlotOn]: Returns @True if time slots are displayed, @Falseotherwise. Applies to calendar views only.

• column: A number. It's required if you use [ColumnValue] as your attribute;otherwise it does not apply. The column numbering starts with 0 for the first columnand includes hidden columns.

It's worth noting how @GetViewInfo can work for you. You can use @GetViewInfo in ahide-action formula to hide an action based on a column value. For example:@GetViewInfo( [ColumnValue]; 4) = "Task" would hide an action in a view ifthe fifth column has a value of "Task".

In standard outline views, @SetViewInfo filters a view to display only documents from aspecified category. In calendar views, it filters a view to display only documents thatcontain a specified string in a specified column. Let's look at the syntax. For a standardoutline view:

@SetViewInfo( [SETVIEWFILTER] ; filterString ; columnName ; isCategory )

For a calendar view:

@SetViewInfo( [SETVIEWFILTER] ; filterString ; columnName ; exactMatch )

Let's look at that in more detail.

• [SETVIEWFILTER]: This keyword is required. It indicates that you want to qualifythe documents that display in a view.

• filterString: Text. Serves as the key to determine which documents display in aview. If this string is present in the column specified in columnName, it includes thedocument in the view.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 35 of 40

• columnName: Text. The programmatic name of a column. The column specifiedhere must contain the filterString for the document to display in the view.

• isCategory: Number. Boolean value. Required in a standard outline view; not foruse in calendar views. 1 indicates that the column in the columnName value is acategory. 0 indicates that it is not.

• exactMatch: Number. Boolean value. Optional in a calendar view; not for use instandard outline views. 1 indicates that the string in the columnName column mustexactly match the string specified in filterString. 0 indicates that thefilterString does not have to match exactly. For instance, if the filterStringis "A," and exactMatch is set to 0, documents with "A" and "A plus" in the columnspecified in columnName will both be included in the view.

New @commands for views

You can also perform the equivalent of the menu command Edit - Restore by usingEditRestoreDocument. The syntax is:

@Command( [EditRestoreDocument] )

In a soft deleted document, this command restores the document to the view or folderfrom which it was deleted. To create a soft deletions view:

• Select File - Database - Properties from the menu bar.

• On the Advanced tab of the Database Properties box, select Allow soft deletions.

• From the View design list in Lotus Domino Designer, select the New View button.

• In the Create View dialog box, enter a name for the view, then choose Shared,contains deleted documents as the view type and click OK.

This creates a view that holds any documents deleted from other views or folders in thedatabase. To permanently remove a document from the database, you must delete itfrom this view.

Note: This command does not work for Web-based applications.

New LotusScript for the NotesUIView class

In the NotesUIView class, there are new properties, methods, and events.

New properties:

• CalendarDateTimeEnd is the end date and time of the current region in a calendarview.

• CaretNoteID is the note ID of the document currently highlighted (that is, at the

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 36 of 40 What's new with forms and views in Domino 6

caret location) in a view.

• ViewInheritedFrom is the name of the view whose design a view inherits.

New methods:

• Close closes a view.

• DeselectAll deselects all documents in a view.

New events:

• InViewEdit occurs at four phases during an in-view edit: query, validate, save, andnew entry (see InViewEdit parameters on page 28 for more information).

• PostEntryResize occurs just after a resize operation in a calendar view.

• QueryEntryResize occurs just before a drag-and-drop operation in a calendarview.

New LotusScript for the NotesView class

In the NotesView class there are new and changed properties, and new methods.

New properties:

• EntryCount is the number of documents in a view.

• IsProhibitDesignRefresh indicates whether a design refresh or replace canoverwrite a view.

• LockHolders contains the names of the holders of a lock.

• SelectionFormula is the selection formula of a view.

• ViewInheritedName is the name of the view whose design a view inherits.

Changed properties:

• Aliases is now read/write.

• BackgroundColor is now read/write.

• IsDefaultView is now read/write.

• Name is now read/write.

• Spacing is now read/write.

New methods:

• CopyColumn creates a new column by copying an existing one.

• CreateColumn creates a new column.

• Lock locks a view.

• LockProvisional locks a view provisionally.

• RemoveColumn removes a column.

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 37 of 40

• SetAliases appends an alias.

• Unlock unlocks a view.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 38 of 40 What's new with forms and views in Domino 6

Section 6. Wrap up

Summary

Domino Designer 6 helps you rapidly create collaborative multiplatform applications toautomate business processes and increase workflow efficiency. This tutorial went oversome of the new features and functions available in Domino Designer 6. We discussedthe user interface of Domino Designer and how you can customize it. Then wediscussed what's new in forms and views. This tutorial did not cover all of the newfeatures and functions in Domino Designer 6, since there isn't enough time to includeall of them. You can download the release notes for Lotus Notes/Domino 6.0.1 (seeResources on page 39 ).

Resources

To download a sample Domino 6 database that takes advantage of several of the newenhancements and features of version 6, select books.nsf.

View and download the Lotus Notes/Domino release notes.

To download any of the products mentioned here, go to the IBM developerWorksToolbox.

Here are a few IBM redbooks on Domino and Domino Designer:

• Domino Designer 6: A Developer's Handbook

• What's New with IBM Lotus Domino 6 for iSeries

• Upgrading to Lotus Notes and Domino 6

• Lotus Domino 6 for Linux

• IBM Lotus Domino 6 for iSeries Implementation

Presented by the Lotus Developer Domain http://www.lotus.com/ldd

What's new with forms and views in Domino 6 Page 39 of 40

Section 7. Feedback

Feedback

Colophon

This tutorial was written entirely in XML, using the developerWorks Toot-O-Matic tutorialgenerator. The open source Toot-O-Matic tool is an XSLT style sheet and several XSLTextension functions that convert an XML file into a number of HTML pages, a zip file, JPEGheading graphics, and two PDF files. Our ability to generate multiple text and binary formatsfrom a single source file illustrates the power and flexibility of XML. (It also saves ourproduction team a great deal of time and effort.)

You can get the source code for the Toot-O-Matic atwww6.software.ibm.com/dl/devworks/dw-tootomatic-p. The tutorial Building tutorials with theToot-O-Matic demonstrates how to use the Toot-O-Matic to create your own tutorials.developerWorks also hosts a forum devoted to the Toot-O-Matic; it's available atwww-105.ibm.com/developerworks/xml_df.nsf/AllViewTemplate?OpenForm&RestrictToCategory=11.We'd love to know what you think about the tool.

http://www.lotus.com/ldd Presented by the Lotus Developer Domain

Page 40 of 40 What's new with forms and views in Domino 6