Manage Learn to apply best practices and optimize your operations.

Accessing Notes Design Elements

There have been lot of code written about accessing the design elements of a
Notes database. I have found this extremely helpful and simple. Hope you find
the same.

Every view has an item called $FormulaClass. You can access this by opening
the database in design mode, opening the views, and selecting properties
(Either the smart icon, or Alt+Enter). In the info box that appears, select
the second tab, "Fields". You will see that $FormulaClass is set to "1" for
all views. By tweaking this value, you can get your view to display
different design elements.

For starters, "2" displays all the forms in the database. "5" displays all
the forms and the documents in the database.

How to get this going..
There is a important lesson to be learnt here, that Notes treats all its
design elements as documents. All design elements contain items, that can
be modified with script. All design elements have an UNID, which is the
collar through which the element has to be hauled up.
Before I start off on the actual implementation, here's a small test you
can run:


Put the following code in an agent and run it.
Dim s As New Notessession
Dim db As Notesdatbase
Set db = s.Currentdatabase.
Dim doc As Notesdocument
Set doc = db.GetDocumentbyUNID("&LTUNID of the form - available in form
design properties>")
Call doc.Remove(true)

This deletes the form from the database.

The code I wrote went this way...

Sub Initialize
Dim w As New NotesUiWorkspace
Dim s As New Notessession
Dim db As Notesdatabase
Set db = s.Currentdatabase
Dim doc As Notesdocument
Set doc = db.GetdocumentbyUNID("7D7A454CC8ADC5C0652566C6001E326F")
If Not(doc Is Nothing) Then
Msgbox doc.Getfirstitem("$Title").Values(0)
Dim item As Notesitem
Set item = doc.Getfirstitem("$FormulaClass")
Msgbox item.Values(0)
item.Values = "2"
Call doc.Save(True, True)
Call w.ViewRefresh()
End If
End Sub

Run the agent, and check out the view contents. Make sure that the view has
columns that can display design element items in them. The safest is to
show the size of the document in the column

I hope it helps.

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close