Sunday, August 1, 1999

Fun with $FormulaClass


By Dan Velasco

What I am about to tell you is true. Only the $FormulaClass has been changed in order to protect the innocent.

Some of you might ask, "What is $FormulaClass?" Well, if you want to be kept up late at night thinking of ways to take advantage of this field/property (which I am doing right now while writing this article), read on. What follows is definitely for developers who want to pull up their sleeves and get their hands dirty.

Put simply, the $FormulaClass field exists on view design documents and controls what the view shows. The default value of $FormulaClass is "1", which causes the view to show only documents. What is extremely cool is that you can use LotusScript to change the value of this field and thus cause a view to show you Notes design documents rather than just plain old everyday documents. Table A shows which values correspond to what the view will show:

Table A: $FormulaClass values
ValueDesign Elements Shown
4Forms and Subforms
8Views, Folders and Navigators
16Database Title
32Design Collection (overall information)
64ACL Note (in compiled format)
512Agents (Shared)
1024Shared Fields
1548Forms, Sub-forms, Views, Folders, Navigators, Agents (Shared), Shared Fields

What's really great about this is that you now have access to all of the field properties of a view. This means that you can display them, sort them and manipulate them however you wish -- with the infinite creative possibilities of Notes views. And, as you can see by the last entry, you can even show multiple types of design elements in a single view. All you need to do is to add the numbers of the design elements you would like to show, in this case 4 + 8 + 512 + 1024, and use the sum (1548) as the value of $FormulaClass.

What you can show

Here is just a small sample of what information you can show and what you can do with the power of changing the $FormulaClass of a view.

  • You can use the value of the $Class field that design elements have in order to show from what template your design elements are inheriting. You can insert a hidden view that shows this information in a database to help analyze from where the design elements for that database are inheriting their design.
  • You can show the alias of a design element in a view. This information is contained within the $Title field. This is not that big of a deal if you are using R5, but is a big help in R4.