|
Introduction
I have now started writing Domino applications
that require to run on both version 5 and version
6 flavours. In most instances no problem - apart
from when I need to retrieve Notes View design
and data via XML.
In version 5 the XML attributes were all in
uppercase (whereas all other XML from Domino
had attributes in lowercase). With the release
of Version 6 they 'corrected' this so all XML
attributes are in lowercase. Bit of a pain but
as a developer you have to get on with it and
as I am so lazy I do not wish to have two copies
of my databases/code if I can help it.
I have therefore made the databases detect
which system they run on and request the correct
attribute information (remembering that XML
and JavaScript are case sensitive).
The important Domino Functionality I am using
here is the @Version formula.
Tip
To start with I created a computed field on
my web form with the formula: @Version.
I surrounded this field with <span> tags
such as:
<span id="version">Version
Field here</span>

The reason for this is so I can retrieve the
value of the field in read mode.
Then I wrote the following detection code so
I can retreive this value when the document
is loaded (placed in the onLoad() event):
version=document.getElementById("version").innerText
I also needed to place a 'global declaration'
within my form so it is available for all my
javascript functions:
<script language='javascript'>
// Global Declarations
var version=""
</script>
When your document is viewed on the web the
value of this field is as follows:
|
Number Returned by @Version
114
136
138
145
147
166
190
|
Corresponding Notes/Domino
version
Notes 3.x
Notes 4.0, 4.0x
Notes 4.1, 4.1x
Notes 4.5, 4.5x
Notes 4.6
Notes 5.0, 5.0x
Notes 6.0, 6.0x
|
The important values here are '166' and '190'
which refer to releases 5 and 6 respectively.
Now I have this version information available
to me I can add the following Javascript within
my XML view retreival code so I do not need
two seperate versions:
var attribute=new Array()
if(version=="190"){
attribute[0]="title"
attribute[1]="width"
attribute[2]="sortcategorize"
attribute[3]="response"
attribute[4]="viewdesign"
attribute[5]="headerlines"
attribute[6]="categories"
attribute[7]="column"
}else{
attribute[0]="TITLE"
attribute[1]="WIDTH"
attribute[2]="SORTCATEGORIZE"
attribute[3]="RESPONSE"
attribute[4]="VIEWDESIGN"
attribute[5]="HEADERLINES"
attribute[6]="CATEGORIES"
attribute[7]="COLUMN"
}
Questions? -
steve.castledine@projectdx.org
|