Jun 14

Session.DocumentContext something isn’t right

If you ran the following code in the Web Query Save agent that was assigned to a form with a subject field. The original value of subject was “Truck” and the new value entered on the web was “Car”. The Web Query Save agent code was:

Dim Session As New NotesSession
Dim docBefore As NotesDocument
Dim documentContext As NotesDocument
Dim docAfter As NotesDocument
Set docBefore = Session.CurrentDatabase.getDocumentByUNID("f02506889e2d5cfc8625712f001b02f9")
Msgbox "Before: " + docBefore.subject(0)
 
Set documentContext = Session.DocumentContext
Msgbox "Context: " + documentContext.subject(0)
Set docAfter = Session.CurrentDatabase.getDocumentByUNID("f02506889e2d5cfc8625712f001b02f9")
Msgbox "After:" + docAfter.subject(0)

I was expecting to see:
Before: Truck
Context: Car
After: Truck

What I saw was:
Before: Truck
Context: Car
After: Truck

Domino seems to read the document from the database until the DocumentContext is used at which the document is read from memory where the changes are allready made. This will make my job capturing what has change for Open Audit a litte hard, thus take a little more time.

Jun 06

Template Build discussion

Currently Set Template Version uses three pieces of information TemplateBuildName, TemplateBuild, and TemplateBuildDate.  Each of these is a string which is not a problem, but Vince created a web service for checking for updates that uses Project, BuildNumber, and BuildName as strings but BuildNumber is a double.  The double is needed to see if there is a new version available, and a string can not be used because 1.1.1 is different than 1.01.01 or 1.1.10.  Thus the discussion!

I would like to see some consistency between these so the Build Template class can work.  The two are very close TemplateBuildName = Project and TemplateBuild = BuildName.  The only difference is the BuildNumber with no corresponding field on the $TemplateBuild shared field.  What I am proposing is enhancing Set Template Version to include on more additional field called Template Build which would be a number allowing a decimal.  Leaving Template Version (TemplateBuild) as a string will allow for 1.0.0 beta 1 and multiple decimals.
Please let me know your thoughts.

May 31

Template Build Class

Updated code to remove extra XML information

Chris suggested that a web service be made available for projects to check for updates at openNTF. Vince implemented this rather quickly so I started to testing it on my projects. Everything worked great, but what I noticed was that I now have to maintain this information in both the ‘Check for Updates’ agent and the $TemplateBuild shared field so that it shows in the database properties.

Remember Chris Doig’s tool to set the build information using a notes database (Great Tool). There is duplicate information in these two tools causing me to maintain the build information in both places. Hopefully I have provided a class that can help reduce the duplicity. The Template Build class will allow the setting and getting of the Template Build, Template Build Name and Template Build Date of the $TemplateBuild shared field. This can be used by the web service to get the information, Chris’s tool can use it to set the information, and anyone else can use it to set or get the information. Then everyone will be happy, at least I will be!!

Here are the methods available:

Public Sub new( )<br>
Public Function GetVersionField() As NotesDocument<br>
Public Function getTemplateBuildName( ) As String<br>
Public Function setTemplateBuildName( BuildName As String )<br>
Public Function getTemplateBuild( ) As String<br>
Public Function setTemplateBuild( Build As String )<br>
Public Function getTemplateBuildDate( ) As NotesDateTime<br>
Public Function hasTemplateBuild( ) As Boolean<br>
Public Sub delete( )<br>




Template Build Class

Option Public
Option Declare
 
'/**
' * Notes/Domino uses a shared field called $TemplateBuild to store the current 
' * build number, build name and build date this class will allow access to the shared field
' * both to read and update.  
' *
' * History
' *14 Apr 2005	Christopher J Doig	Initial version
' *30 May 2006	Chad Schelfhout ( http://www.chadsmiley.com )
' *		Converted function to class
' *		Setters and getters for Build information
' * 		Allow the creation of the shared field if it does not exist
' */
Class TemplateBuild
	SharedFieldTitleName As String
	SharedFieldName As String
	TemplateBuildNameField As String
	TemplateBuildField As String
	TemplateBuildDateField As String
 
	docTemplateBuild As NotesDocument
	session As NotesSession
	saveDocTemplateBuild As Boolean
	Public Sub New ()
		SharedFieldTitleName = "$Title"
		SharedFieldName = "$TemplateBuild" 
		TemplateBuildNameField = "$TemplateBuildName"
		TemplateBuildField = "$TemplateBuild"
		TemplateBuildDateField = "$TemplateBuildDate"
 
		Set session = New NotesSession
		saveDocTemplateBuild = False
		Call GetVersionField()
	End Sub
'/*
' * 	Attempt to load the Build information if it is not there then import the DXL to create
' * the shared field then try and load the Build information again.
' */
	Public Function GetVersionField () As NotesDocument
		Call attemptLoad()
		If docTemplateBuild Is Nothing Then
			Call createBuildTemplateField()
			Call attemptLoad()
		End If
		Set GetVersionField = docTemplateBuild
	End Function
 
'/*
' * Search for the shared field called $TemplateBuild
' */
	Private Sub attemptLoad() 
 
		Dim doc As NotesDocument
		Dim nc As NotesNoteCollection
		Dim item As NotesItem
		Dim strID As String
 
		Set nc = session.CurrentDatabase.CreateNoteCollection ( False )
		nc.SelectSharedFields = True
		Call nc.BuildCollection
		strID = nc.GetFirstNoteId
 
		Set docTemplateBuild = Nothing
		Do Until strID = ""
			Set doc = session.CurrentDatabase.GetDocumentByID ( strID )		
			Set item = doc.GetFirstItem ( SharedFieldTitleName )
			If item.Text = SharedFieldName Then
				Set docTemplateBuild = doc
				Exit Do
			End If
			strID = nc.GetNextNoteId ( strID )
		Loop
	End Sub
'/*
' * Import a shared field called $TemplateBuild
' */
	Private Sub createBuildTemplateField()
 
		Dim importer As NotesDXLImporter
		Set importer = session.CreateDXLImporter
 
		importer.DesignImportOption = DXLIMPORTOPTION_CREATE
		Call importer.Import( |<?xml version='1.0' encoding='utf-8'?><!DOCTYPE sharedfield>
		<sharedfield name='$TemplateBuild' xmlns='http://www.lotus.com/dxl' language='en'>
	<field type='text' kind='editable' name='$TemplateBuild'/>
	<item name='$TemplateBuildName' sign='true'>
		<textlist>
			<text>Application Name</text>
		</textlist>
	</item>
	<item name='$TemplateBuild' sign='true'>
		<textlist>
			<text>0.0.0</text>
		</textlist>
	</item>
	<item name='$TemplateBuildDate' sign='true'>
		<datetimelist>
			<datetime dst='true'>19010101T000000,00-07</datetime>
		</datetimelist>
	</item>
</sharedfield>| , Session.CurrentDatabase )
		saveDocTemplateBuild = True
	End Sub
'/*
' * Get, Set Template Build Name
' */	
	Public Function getTemplateBuildName As String
		getTemplateBuildName = ""
		If hasTemplateBuild Then
			If docTemplateBuild.HasItem( TemplateBuildNameField ) Then
				getTemplateBuildName = docTemplateBuild.getFirstItem( TemplateBuildNameField ).text
			End If
		End If
	End Function
	Public Sub setTemplateBuildName ( BuildName As String )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildNameField ,  BuildName )
			saveDocTemplateBuild = True
		End If
	End Sub
 
'/*
' * Get, Set Template Build
' */	
	Public Function getTemplateBuild	As String
		getTemplateBuild = ""
		If hasTemplateBuild Then
			If docTemplateBuild.HasItem( TemplateBuildField ) Then
				getTemplateBuild = docTemplateBuild.getFirstItem( TemplateBuildField ).text
			End If
		End If
	End Function
	Public Sub setTemplateBuild ( Build As String )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildField ,  Build )
			saveDocTemplateBuild = True
		End If
	End Sub
 
'/*
' * Get, Set Template Build Date
' */	
	Public Function getTemplateBuildDate As NotesDateTime
		Set getTemplateBuildDate = New NotesDateTime( "0/0/0" )
		If hasTemplateBuild Then
			If ( docTemplateBuild.HasItem( TemplateBuildDateField ) ) Then
				Set getTemplateBuildDate = docTemplateBuild.getFirstItem( TemplateBuildDateField ).dateTimeValue
			End If
		End If
	End Function
	Public Sub setTemplateBuildDate ( BuildDate As NotesDateTime )
		If hasTemplateBuild Then
			Call docTemplateBuild.ReplaceItemValue( TemplateBuildDateField ,  BuildDate )
			saveDocTemplateBuild = True
		End If
	End Sub
 
	Public Function hasTemplateBuild As Boolean
		hasTemplateBuild = Not ( docTemplateBuild Is Nothing)
	End Function
 
	Public Sub delete 
		If saveDocTemplateBuild Then
			Call docTemplateBuild.Save( True , False )
			saveDocTemplateBuild = False
		End If
	End Sub
End Class
Apr 27

SnT Thursday – View Icons as Categories

I like to check how referrers are getting to this blog, so I use the view ‘Referers\All by Date’ view to monitor it. One of my frustrations about this view is that either a refer is marked as valid or invalid. Which is not totally accurate because not all invalid entries have been validated. So I added a third icon that indicates that the referrer has not been validated. The third icon helped but I still found myself wasting time looking through the documents.

To speed things up I added categorization (descending order) to the indicator column and my view now looks like this:


There is only one thing wrong with this, no twisties! As you can see (second picture) I do have them set to show. Even tried using my own ‘Twistie Image’ but still no luck. When ‘Display values as icons’ is disabled the twisties appear in Notes. No matter the setting for this column the twisties always show on the web, thanks Lotus for the consistency.

The column formula is very simple:

@If(Verify = 1; 82; Verify = 0; 81; 162)

Update: It seems that the view icon is the twistie because clicking on the image once expands or collapses it.

Mar 31

Some links

IE Developer Toolbar is now in Beta 2

Debugging with Domiclipse a tutorial

InsideLotus has a top 5 reasons to use firefox .  I converted my tab enhancement from tabx to tab mix plus .  The progress bar in th tab title is really cool, I also like the tab title changes when the tab has not been visited yet. Jake is using FireBug with firefox that is a nice companion to Web Developer.

Also found a nice list of Yahoo! Widget’s by Jon Aquino
I am a little partial to the smiley face:
I wonder if Bruce would be interested:

Feb 13

I am back and Web-based IDE

I am back from the thumb vacation again!  Nothing exciting to report at The Rushes in  Door County, but we enjoyed our time there.

Tim has a really cool idea about creating and maintaining Domino applications through a web base IDE using DXL.  

A project soon to be added to OpenNTF is a web-based IDE for Domino. The back end will rely heavily on DXL, which will handle the presentation of existing code as well as creation and modification of design elements. Before I start the project, however, I’d like your ideas and advice for a few aspects of this.

The idea sounds great and I would be very interested in such a tool.  Maybe some of the work that Mikkel has done with LotusScript.doc, might be a useful!  I would like to see that ability to update forms and views before LotusScript because little tweaks of the UI are always asked for.  Sorry no name here, way to late for that.  I personally would like to see IE and Firefox support.

Aug 26

Dynamic Domino Web Form Design

Some Domino applications have many forms that basically have the same information with some different fields. These forms have no logic, but are used to capture data. I am considering using Mike’s Submitting Web Forms without Domino Fields concept and creating a dynamic form for the web. This would reduce development time and greatly reduce testing.


There would be three different forms and one agent:

  • The agent would read the post back and create/update the document with the field values
  • Basic web form shell – would contain the style sheets and the agents for saving and lookups to determine the fields. It would contain a table with two columns when rendered, the first column would be the field description and the second would be the value.
  • Form definition – would define the title and the dynamic form alias.
  • Field form – Defines the fields that appear on the form. Here is the list of the fields and a brief description
Form Multi-value selection of the forms that the field would appear on
Order A number field that would determine what order the field would appear in
Enabled Yes/No
Description Shown in the first column of the table
Name Name used to store the value on the Notes document
Visible Yes/No
Editable Yes/No
Default Value If editable, Use Formula language to determine value
Computed Value If not editable, Use Formula language to determine value
Type Type of field: drop down, list box, check box, radio button, Text, number, Date, Multi-line text
Type Attributes
HTML attributes
Style, width, rows …
Show calendar selector
Yes/No – Shows the calendar icon next to the field (Date Only)
Columns
The number of columns displayed ( check box, radio button)
Lookup Only available for drop down, list box, check box, radio button
Reference Lookup Name
The name of the reference lookup (See:http://www.chadsmiley.com/ReferenceLookup for more detail) for more detail)
View
Name of the view
Filter
For Lookups the value to limit the results (Formula allowed)
Return Column/Field Name
The value to return
Return Mapping
The field to set when result is returned (Formula allowed)
Format (Regular Expressions) Used for values like numbers, and dates
Format Message Message when value does not match expression, this would be used on the blur of the field
Validate Used for values like numbers, and dates
Validate Message Message when value does not match expression, when trying to submit
Goto Field Yes/No
Goto Field Name If validation failed this would be used to set the focus of the field that failed


The Form field would now point at the basic web shell form but there would be a second field maybe called FormDynamic that would be used to look up the dynamic form and field information. When composing a new form the URL would look as follows which would load the Team defined fields:
SomeDatabase.nsf?DynamicFormShell?OpenForm&DynamicForm=Team


I would greatly appreciate any feedback/comments on this initial design.

Mar 25

Site update

I have finally been able to remove my customization of running JavaScript on the loading of my web pages. The JavaScript would Color Code Domino Formula if there was some marked on the page. Now that I have the ability to Format Formula as HTML I will be putting it all together in the HTML. My biggest problem was the size of my Edit Document Fields 4.1 and limit of 20K for a text field. I had to move the ability to select all the code to a new Page. Please let me know if I have missed something.

I have also added a category for “Smiley Tools” on the left.