Search

About Me

I am the "Lotus Technology & Productivity Advisor" for IBM Asia Pacific. I'm based in Singapore.

Visitors to wissel.net

My (business) network meberships

Darwin at work. Business networks sprout like pimples on a teenager's face. Only few will survive, this are my bets:
Ryze Business Network
OpenBCXING
LinkedIn
Orkut
Friend-of-a-friend
4friends.net
Rotary Tanglin

Gaping Void

GTD

MiscLinks

« On OOXML and ISO | Main| How I got started with Lotus Notes »

View Selection Formulas

QuickImage Application performance in Notes and Domino can greatly vary depending on the number of views and the view selection formulas you use. When inheriting databases applications for maintainance there is no real easy way to get an overview what view selection formulas have been used. So I did write myself a function that creates a document with such an overview table.See the function below. To test it I simply copy it into an agent and call it for the current database.
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
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.
Update: Sorry folks, got the wrong code in the core functionsm fixed now. Enjoy!
and here the core function:
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
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Comments

Gravatar Image1 - something wrong with the "core function" ?

Gravatar Image2 - I concur with #1. Methinks there was a cut/paste malfunction. Emoticon

Gravatar Image3 - Hi Stephan,

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

Gravatar Image4 - @Thomas,

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.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::rolleyes:;-)

Disclaimer

This site is in no way affiliated, endorsed, sanctioned, supported, nor enlightened by Lotus Software nor IBM Corporation. I may be an employee, but the opinions, theories, facts, etc. presented here are my own and are in now way given in any official capacity. In short, these are my words and this is my site, not IBM's - and don't even begin to think otherwise. (Disclaimer shamelessly plugged from Rocky Oliver)

© 2003 - 2008 Stephan H. Wissel - all rights reserved as listed here: Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution/NonCommercial/ShareAlike Creative Commons License, with the exception that no rights are granted -- since they are not mine to grant -- in any logo, graphic design, trademarks or trade names of any type.

Get Firefox Use OpenDNS