Friday, December 30, 2011

$Formulaclass- Reservefield

We know that, we can see the saved documents in database in views.

Is there any chance to view all design elements in a single view?

Yes, we can view those design elements in view by changing the value of reserved field.

Hint: Fields name start with $ be the reserve field.

In view there is a reserve field called $FormulaClass. As default its value is 1. If the value is 1, it shows only the saved documents in the view.


Value of $FormulaClass Viewing Elements

1 Documents

4 Forms and Subforms

8 Views, Folders and Navigators

16 Database Title

32 Design Collection

64 ACL Note (in compiled format)

512 Agents (Shared)

1024 Shared Fields

1548 Forms, Sub-forms, Views, Folders, Navigators, Agents(Shared), Shared Fields

If we change the value of &FormulaClass into 1548(sum of 4 + 8 + 512 + 1024) it shows all Forms, Sub-forms, Views, Folders, Navigators, Agents (Shared), Shared Fields.

For Example: Follow the below steps to get clear idea on that.

Step 1: Create a new view named as “ViewDesignElements”(user defined name) and give “SELECT @All” as view selection formula in programming pane.

Step 2: Create two columns and name as “Design Element Type” & “Design Element Name”.

Step 3: For “Design Element Name” column give “$Title” as formula for column value. And categorize “Design Element Type” column.

Step 4 : Then create an LotusScript Agent and name it as “designAgent”.

Step 5 : Type the following code in Initialize of the agent.

This script is to change the value of “$FormulaClass”.

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim doc As NotesDocument

Set db = session.CurrentDatabase

Set view= db.GetView(”ViewDesignElements”)

Set doc = db.GetDocumentByUNID(view.UniversalID)

Call doc.ReplaceItemValue(”$FormulaClass”, “1548″)

doc.Save True, True

End Sub

Step 6 : Create an action button in the view to run the agent by event. Now enter the following code for action button.

@Command([ToolsRunMacro];”designAgent”)

Step 7 : Now Preview the view and click the action button. It will run agent and changes the $FormulaClass value as 1548 to view all design elements.

Step 8 : Then press Shift + F9 to refresh. It will show all the design elements.

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. great help... thanks,
    One writing style point: Use a proper noun wherever a pronoun is used. Proper nouns may get redundant; however, ESPECIALLY with Technical Writing, 'exactitude' is imperative: e.g.
    "it will show" "it shows" "it will run" "it will show" " Then create an LotusScript Agent and name it as “designAgent”"

    This "it" thing is everywhere, Put the Proper name/noun in place of any pronoun and the reader knows exactly what the writer is imagining in the writer's head.
    Pronouns: These Those Them It That They There He She We

    ReplyDelete