View Selection Formulas
Application performance in Notes and Domino can greatly vary depending on the number of views and the view selection formulas you use. When inheriting Of course you could think of running it against multiple databases or altering the html with some Ajax stuff to make it sortable. Here is my test agent:
Option Public Option Declare Sub Initialize Dim s As New NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Set db = s.CurrentDatabase Set doc = db.CreateDocument Call ReportViewSelectionFormulas(db, doc) Call doc.send(False,s.UserName) End Sub
provided by Julian Robichaux at nsftools.com.
Sub ReportViewSelectionFormulas(db As NotesDatabase, doc As NotesDocument) Dim s As New NotesSession Dim v As NotesView Dim out As NotesStream Dim mime As NotesMimeEntity Dim header As NotesMimeHeader Dim body As NotesMimeEntity Dim oddRow As Boolean s.ConvertMIME = False ' Do not convert MIME to rich text Call doc.ReplaceItemValue("Form","Memo") Set mime = doc.CreateMIMEEntity Set header = mime.CreateHeader("Subject") Set body = mime.CreateChildEntity Call header.SetHeaderVal("View selection formula report for "+db.Title) Set header = mime.CreateHeader("SendTo") Call header.SetHeaderVal(s.UserName) Set out = s.CreateStream oddRow = True out.WriteText(|<style>|) out.WriteText(|table {width : 100%; padding : 3px; border-left : 1px solid gray; border-top : 1px solid gray} |) out.WriteText(|body, th, td {text-align : left, font-family : Verdana, Arial, sans-serif} |) out.WriteText(|th {background-color : #FFCCCC} |) out.WriteText(|h1 {background-color : #FF9999; border-bottom : 2px black; font-family : Arial, sans-serif; font-size : large} |) out.WriteText(|td, th { border-bottom : 1px solid gray; border-right : 1px solid gray} |) out.WriteText(|</style>|) out.WriteText(|<h1>|) out.WriteText(db.Title) out.WriteText(|</h1>|) out.WriteText(|<table width="100%"><tr><th>View</th><th>Alias</th><th>Selection Formula</th></tr>|) Forall curView In db.Views Set v = curView If oddRow Then out.WriteText(|<tr><td>|) oddRow = False Else out.WriteText(|<tr style="background-color : #EEEEEE"><td>|) oddRow = True End If out.WriteText(v.Name) out.WriteText(|</td><td>|) 'The view alias If Isempty(v.Aliases) Then out.Writetext(|./.|) Else Forall curAlias In v.Aliases out.WriteText(curAlias) out.WriteText(" ") End Forall End If out.WriteText(|</td><td>|) out.WriteText(v.SelectionFormula) out.WriteText(|</td></tr>|) End Forall out.Position = 0 out.WriteText("</table>") Call body.SetContentFromText(out,"text/html; charset=UTF-8", ENC_IDENTITY_7BIT) s.ConvertMIME = True ' Restore conversion End Sub
provided by Julian Robichaux at nsftools.com.
- 





Comments
Posted by Giuseppe At 06:35:31 On 05.04.2008 | - Website - |
Posted by tom At 14:55:02 On 05.04.2008 | - Website - |
for the fast overview the Design Synopsis could be sufficient. Just deactivate everything in the details for views, but the selection formula, and add all views to the synopsis.
It not nice, but fast, and works without design modifications.
Thomas
Posted by Thomas BAhn At 05:22:17 On 10.04.2008 | - Website - |
you are right, Synopsis would work. My example code however is taken out of context. I added the sub initialize for illustration only. The full code actually lives in a utility database, that scans the design of external databases, so I actually don't change the design either. It is one part of a "brute force" view tuning tool. Stay tuned for more on that.
Posted by Stephan H. Wissel At 10:27:26 On 10.04.2008 | - Website - |