Friday, 8 August 2008

Remove Duplicate Documents v1.0




' Note that this solution works as an agent in the db you have the duplicates

Lotus Notes Database Synopsis - Generated at 11:14:31 on 04/06/2008
Agent Information
Name: ATK\Simple Find and Remove Duplicates Modules Version
Last Modification: 30/05/2008 16:15:54
Comment: sets duplicates to have the extra code ****
Shared Agent: Yes
Type: LotusScript
State: Enabled
Trigger: Manually From Actions Menu
Acts On: None
LotusScript Code:
Option Public
Option Declare
%INCLUDE "lsconst.lss"
' finds the % samenesss between 2 documents
' 100% means all fields match
' 0% means no fields match.
' you can ignore blank fields
Sub Initialize
' #######################################################
' loop through view and move duplicates to folder
' Checks based on what is in column 1
' Identify duplicates by all fields, but ignore certain ones eg $Conflict
' #######################################################
Dim strViewToUse As String
Dim s As New notessession
Dim db As notesdatabase
Dim vwDocumentsToCheck As NotesView
Dim doc1 As NotesDocument, doc2 As NotesDocument
Dim blDocsAreSame As Boolean
Dim intDocsProcessed As Integer, intDocsTotal As Integer, intDuplicatesFound As Integer
Dim doc3 As notesDocument
Dim v1 As Variant, v2 As Variant
Set db =s.currentdatabase
' #######################################################
' Ask use which view to use
' #######################################################
strViewToUse = PromptForViewName()
Set vwDocumentsToCheck = db.getview( strViewToUse )
' #######################################################
' Clear out the duplicates folder
' #######################################################
Dim fldrDuplicatesATK As NotesView
Set fldrDuplicatesATK = db.GetView("DuplicatesATK")
If Not fldrDuplicatesATK Is Nothing Then
Call fldrDuplicatesATK.AllEntries.RemoveAllFromFolder("DuplicatesATK")
End If
Set doc1 = vwDocumentsToCheck.getfirstdocument
intDocsTotal = vwDocumentsToCheck.AllEntries.Count
' #######################################################
' Loop through all docs in view, compare 1st with 2nd etc. Assume they are in alphabetical order.
' #######################################################
intDocsProcessed = 0
Set doc2=vwDocumentsToCheck.getnextdocument(doc1)
Do While Not (doc1 Is Nothing) And (Not (doc2 Is Nothing))
If doc2 Is Nothing Then
'no more documents, end of view
Exit Do
End If
Set doc3 = vwDocumentsToCheck.GetNextDocument(doc2)
' if the doc has different fields, then put it into a folder for checking with notes
blDocsAreSame = AreDocumentsSame( doc1, doc2 )
CheckAndNextDoc:
If blDocsAreSame = True Then
intDuplicatesFound = intDuplicatesFound + 1
doc1.PutInFolder("DuplicatesATK")
End If
NextDoc:
intDocsProcessed = intDocsProcessed + 1
If intDocsProcessed Mod 50 = 0 Then
Print "Duplicates " + Cstr(intDuplicatesFound) + ". Processed " + Cstr(intDocsProcessed ) " / " + Cstr(intDocsTotal)
End If
Set doc1=doc2
Set doc2=doc3
Loop
Dim twoLiner As String
twoLiner = "Duplicates moved to folder. Have a look in the folder named duplicates aTk. Cut them to a back updb"
Messagebox twoLiner, MB_OK, "Demo"
Dim ws As New NotesUIWorkspace
Dim uidb As NotesUIDatabase
Set uidb = ws.CurrentDatabase
Call uidb.OpenView("DuplicatesATK")
Print "Completed. Duplicates " + Cstr(intDuplicatesFound) + ". Processed " + Cstr(intDocsProcessed ) " / " + Cstr(intDocsTotal)
End Sub
Function AreDocumentsSame( doc1 As NotesDocument, doc2 As NotesDocument ) As Boolean
Dim strFieldsToIgnoreArr(0 To 1) As String ' hardcoded to use 3 fields to ignore
Dim v As Variant
Dim intNumItemsOnDoc As Integer, intItemIndex As Integer
Dim itemOnDoc1 As NotesItem
Dim itemOnDoc2 As NotesItem
Dim blDocsAreSame As Boolean
strFieldsToIgnoreArr(0) = "$revisions"
strFieldsToIgnoreArr(1) = "$conflictaction"
intNumItemsOnDoc = Ubound(doc1.Items)
intItemIndex = 0
blDocsAreSame = True ' assume true, set to false if it fails anywhere
While intItemIndex <= intNumItemsOnDoc And blDocsAreSame = True
Set itemOnDoc1 = doc1.Items(intItemIndex)
'===========================================
' Set itemOnDoc to be the first field from doc1, excluding fields we are ignoreing
While (intItemIndex < intNumItemsOnDoc And (Lcase(itemOnDoc1.Name) = strFieldsToIgnoreArr(0) Or _
Lcase(itemOnDoc1.Name) = strFieldsToIgnoreArr(1) ))
intItemIndex = intItemIndex + 1
Set itemOnDoc1 = doc1.Items(intItemIndex)
Wend
If intItemIndex = intNumItemsOnDoc And ((Lcase(itemOnDoc1.Name) = strFieldsToIgnoreArr(0) Or _
Lcase(itemOnDoc1.Name) = strFieldsToIgnoreArr(1)) ) Then
Goto ExitFunction
End If
'===========================================
' Check if the item is on doc2, if diff, set to false
' Print itemOnDoc1.Name + " " itemOnDoc1.ValueLength
If Not doc2.HasItem( itemOnDoc1.Name ) Then
blDocsAreSame = False
Else
Set itemOnDoc2 = doc2.GetFirstItem(itemOnDoc1.Name)
If itemOnDoc1.Text <> itemOnDoc2.Text Then
blDocsAreSame = False
'Print "Note about Doc1. " +_
'"Docs have diff values for " + itemOnDoc1.Name
'Print "Item on Doc1 is " + itemOnDoc1.Text
'Print "Item on Doc2 is " + itemOnDoc2.Text
End If
End If
intItemIndex = intItemIndex + 1
Wend ' all items on doc
ExitFunction:
AreDocumentsSame = blDocsAreSame
End Function
Function PromptForViewName( ) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewsArray As Variant
Dim intSize As Integer
Dim i As Integer
Dim strViewName As String
Dim strDefaultName As String
Dim ws As New NotesUIWorkspace()
Set db = session.CurrentDatabase
viewsArray = db.Views
intSize = Ubound(viewsArray)
Redim strViewNamesArr(intSize) As String
Forall v In viewsArray
strViewNamesArr(i) = v.Name
If v.Name = "Contacts" Then
strDefaultName = "Contacts" ' if there is a contacts view, we will default to that
End If
i = i + 1
End Forall
'############################################
' Prompt for view name... default to contact if we have it
'############################################
If strDefaultName = "" Then
strDefaultName = strViewNamesArr(0)
End If
strViewName = ws.Prompt (PROMPT_OKCANCELLIST, _
"Select a View", _
"Select a view to use - (should have first column sorted.)", _
strDefaultName, strViewNamesArr)
If Isempty (strViewName) Then
strViewName = ""
End If
PromptForViewName = strViewName
End Function


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Tuesday, 5 August 2008

Some good software

 

Desktop search - http://www.dkellner.hu/freeware/finder/

Very quick. It works.

Bad - No

 

--------------------------

Thinking Rock - Free GTD Win, Mac, Linux Software

-----------------------

Excel Colour Conditional Formatting

 

I sometimes use excel like a calendar, and set the weekends to an different colour.

1. Select the cells
2. Select Format -> Conditional Formatting

image

3. Assuming that you have the date in column A, Add the following formula

=IF(WEEKDAY($A2)=1, TRUE, FALSE)

3. image 

Possibly use this macro:

Sub ColorWeekends()
'
' ColorWeekends Macro
' Macro recorded 05/08/2008 by Anthony Kendrick
'

    Rows("2:32").Select
    Selection.FormatConditions.Delete
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=IF(WEEKDAY($A2)=1, TRUE, FALSE)" ' 2 is the first row with data
    Selection.FormatConditions(1).Interior.ColorIndex = 11 ' 11 is blue
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=IF(WEEKDAY($A2)=7, TRUE, FALSE)"
    Selection.FormatConditions(2).Interior.ColorIndex = 3 ' 3 is red
    Range("C21").Select


End Sub

Monday, 4 August 2008

Netbooks to Buy

imageMSI Wind - 80GB drive. 

 

 

 

 

 

 

 

Acer Aspire 1 - Quite good. Keyboard etc. 8GB drive. image

Thursday, 31 July 2008

Self Test Software or CertFX Lotus Notes Certification

I have just updated my Lotus Notes certification to Level 7 Advanced Application Developer. To get there I did 2 exams, the 7 Update Exam and the Advanced LotusScript Exam.

Conclusion:
Both are good products and will help you pass the exams. If you like the slicker look then go for CertFX, if you want more questions and maybe a not so nice interface, yet easier to use for checking on questions you got wrong etc, then I'd go for the Self Test Sofware.
Happy Studying!


To study for the exams, for the update exam, I used the Self Test Software and for the Advanced exam, I used the CertFX software. My method for studying, was to do the practice exams section by section, when I get questions wrong, read up on them from the exam and read up supplementary information.


Self Test Software - Update Exam 7 - I got 90%
Pros:
- Lots of options on reviewing questions you get wrong and learning. Can learn now on
questions you get wrong. 
- Automatically saves test results.
Cons:

self test

self test - results2

self test - results

self test2


CertFX Software - Advanced LotusScript Exam - I got 90%
Pros: Nice review of questions in tabular format. Very nice UI. Updates from web
Cons: Can't do learn now on questions you get wrong. Slow when can't connect to web, eg the help did not work, possibly a proxy issue from my end,  but not great. 

certfx1

Conclusion:
Both are good products and will help you pass the exams. If you like the slicker look then go for CertFX, if you want more questions and maybe a not so nice interface, yet easier to use for checking on questions you got wrong etc, then I'd go for the Self Test Sofware.
Happy Studying!

Free image site - Really free

http://www.sxc.hu/index.phtml

Vista start menu for XP - ViStart

Still in beta, this is a program to watch out for. It is buggy now, but would expect the next release to be good, both for starting programs ( I currently use launchy for windows ) and for searching for files.

http://lee-soft.com/

Thursday, 10 July 2008

Linux Media Centre - Elisa

http://elisa.fluendo.com/

How to set custom shortcuts in the Windows XP “Save As” dialog box


  1.  This tutorial will guide you in setting custom “shortcuts” in the Windows XP “Save As” dialog box. note: this also works in Windows Vista Ultimate Edition - but I’m not sure about the other versions of Vista.


  2. Click Start and select Run. In the Run window enter gpedit.msc and click OK.  


  3. The Group Policy editor will appear. 


  4. In the left window select the + (plus sign) next to User Configuration to expand the list. Next select the plus sign next to Administrative Templates and then Windows Explorer. Finally, select the Common Open File Dialog entry.  

  5. Double-click the Items displayed in Places Bar entry in the main Group Policy window.  
  6.  Select Enabled 

#Via Simple Help

No to All in Windows XP file replace

Thursday, 26 June 2008

Nice blogger templates

Try here: http://mashable.com/2007/09/13/blogger-templates/

Lotus Notes does have Mark as Unread!

markUnread 

Talk about UI problems. I do love what Notes can do but really, sometimes!!!! Ahh. I have worked with Notes for  10 years, and still have trouble finding things in the UI!

To be clear:, In the email, Lotus Notes does have Mark as Unread… it’s in the Edit Menu. Surely it should be in the context menu!

Friday, 30 May 2008

PromptForViewName

Function PromptForViewName( ) As String

Dim session As New NotesSession
Dim db As NotesDatabase
Dim viewsArray As Variant
Dim intSize As Integer
Dim i As Integer
Dim strViewName As String
Dim strDefaultName As String
Dim ws As New NotesUIWorkspace()

Set db = session.CurrentDatabase
viewsArray = db.Views

intSize = Ubound(viewsArray)
Redim strViewNamesArr(intSize) As String

Forall v In viewsArray
strViewNamesArr(i) = v.Name
If v.Name = "Contacts" Then
strDefaultName = "Contacts" ' if there is a contacts view, we will default to that
End If
i = i + 1

End Forall

'############################################
' Prompt for view name... default to contact if we have it
'############################################
If strDefaultName = "" Then
strDefaultName = strViewNamesArr(0)
End If

strViewName = ws.Prompt (PROMPT_OKCANCELLIST, _
"Select a View", _
"Select a view to use - (should have first column sorted.)", _
strDefaultName, strViewNamesArr)

If Isempty (strViewName) Then
strViewName = ""
End If

PromptForViewName = strViewName

End Function

Thursday, 22 May 2008

function MakeSafeForURL js

function MakeSafeForURL(strText) {
//eg given it's great+,
// returns it%20 great%2B
//return encodeURIComponent(strText);

strText = strText.replace(/'/g, "");
strText = strText.replace(/"/g, "");
strText = strText.replace(/\+/g, "");
strText = strText.replace(/&/g, "");
strText = strText.replace(/%/g, "");

return strText
}

Tuesday, 20 May 2008

Function



Function GetDbInfoFromReplicaID( strReplicaId As String, strServer As String )

Dim db As New NotesDatabase("","")
Dim blOpened As Boolean

blOpened = db.OpenByReplicaID( strServer, strReplicaId )
If blOpened = False Then
Error 1000, "The database is not found to open by replica id ("+ strReplicaID+") to get the information on the server ("+ strServer +")"
End If

GetDbInfoFromReplicaID = db.Title + "|" + db.FilePath + "|" + db.Server

End Function


Monday, 19 May 2008

Notes Designer Not Installed - maybe it is




A neat trick. If designer is not installed, but Lotus Notes is, try this trick. Create a text file in the notes directory. Call it designer.exe. Launch the notes client and you will see the desinger icon in the bookmarks bar.






( via Simon's Notes : Domino
Designer Not Installed? No Problem :-)


Wednesday, 9 April 2008

Various flags eg from folders


various flags below (from the C API stdnames.h file) with the appropriate line bolded.





/* Please keep these flags in alphabetic order (based on the flag itself) so that

we can easily tell which flags to use next. Note that some of these flags apply

to a particular NOTE_CLASS; others apply to all design elements. The comments

indicate which is which. In theory, flags that apply to two different NOTE_CLASSes

could overlap, but for now, try to make each flag unique. */



#define DESIGN_FLAG_ADD 'A' /* FORM: Indicates that a subform is in the add subform list */

#define DESIGN_FLAG_ANTIFOLDER 'a' /* VIEW: Indicates that a view is an antifolder view */

#define DESIGN_FLAG_BACKGROUND_FILTER 'B' /* FILTER: Indicates FILTER_TYPE_BACKGROUND is asserted */

#define DESIGN_FLAG_INITBYDESIGNONLY 'b' /* VIEW: Indicates view can be initially built only by designer and above */

#define DESIGN_FLAG_NO_COMPOSE 'C' /* FORM: Indicates a form that is used only for */

/* query by form (not on compose menu). */

#define DESIGN_FLAG_CALENDAR_VIEW 'c' /* VIEW: Indicates a form is a calendar style view. */

#define DESIGN_FLAG_NO_QUERY 'D' /* FORM: Indicates a form that should not be used in query by form */

#define DESIGN_FLAG_DEFAULT_DESIGN 'd' /* ALL: Indicates the default design note for it's class (used for VIEW) */

#define DESIGN_FLAG_MAIL_FILTER 'E' /* FILTER: Indicates FILTER_TYPE_MAIL is asserted */

#define DESIGN_FLAG_PUBLICANTIFOLDER 'e' /* VIEW: Indicates that a view is a public antifolder view */

#define DESIGN_FLAG_FOLDER_VIEW 'F' /* VIEW: This is a V4 folder view. */

#define DESIGN_FLAG_V4AGENT 'f' /* FILTER: This is a V4 agent */

#define DESIGN_FLAG_VIEWMAP 'G' /* VIEW: This is ViewMap/GraphicView/Navigator */

#define DESIGN_FLAG_FILE 'g' /* FORM: file design element */

#define DESIGN_FLAG_OTHER_DLG 'H' /* ALL: Indicates a form that is placed in Other... dialog */

#define DESIGN_FLAG_JAVASCRIPT_LIBRARY 'h' /* Javascript library. */

#define DESIGN_FLAG_V4PASTE_AGENT 'I' /* FILTER: This is a V4 paste agent */

#define DESIGN_FLAG_IMAGE_RESOURCE 'i' /* FORM: Note is a shared image resource */

#define DESIGN_FLAG_JAVA_AGENT 'J' /* FILTER: If its Java */

#define DESIGN_FLAG_JAVA_AGENT_WITH_SOURCE 'j' /* FILTER: If it is a java agent with java source code. */

#define DESIGN_FLAG_MOBILE_DIGEST 'K' /* to keep mobile digests out of form lists */

#define DESIGN_FLAG_CONNECTION_RESOURCE 'k' /* Data Connection Resource (DCR) for 3rd party database */

#define DESIGN_FLAG_LOTUSSCRIPT_AGENT 'L' /* FILTER: If its LOTUSSCRIPT */

#define DESIGN_FLAG_DELETED_DOCS 'l' /* VIEW: Indicates that a view is a deleted documents view */

#define DESIGN_FLAG_QUERY_MACRO_FILTER 'M' /* FILTER: Stored FT query AND macro */

#define DESIGN_FLAG_SITEMAP 'm' /* FILTER: This is a site(m)ap. */

#define DESIGN_FLAG_NEW 'N' /* FORM: Indicates that a subform is listed when making a new form.*/

#define DESIGN_FLAG_HIDE_FROM_NOTES 'n' /* ALL: notes stamped with this flag

will be hidden from Notes clients

We need a separate value here

because it is possible to be

hidden from V4 AND to be hidden

from Notes, and clearing one

should not clear the other */

#define DESIGN_FLAG_QUERY_V4_OBJECT 'O' /* FILTER: Indicates V4 search bar query object - used in addition to 'Q' */

#define DESIGN_FLAG_PRIVATE_STOREDESK 'o' /* VIEW: If Private_1stUse, store the private view in desktop */

#define DESIGN_FLAG_PRESERVE 'P' /* ALL: related to data dictionary */

#define DESIGN_FLAG_PRIVATE_1STUSE 'p' /* VIEW: This is a private copy of a private on first use view. */

#define DESIGN_FLAG_QUERY_FILTER 'Q' /* FILTER: Indicates full text query ONLY, no filter macro */

#define DESIGN_FLAG_AGENT_SHOWINSEARCH 'q' /* FILTER: Search part of this agent should be shown in search bar */

#define DESIGN_FLAG_REPLACE_SPECIAL 'R' /* SPECIAL: this flag is the opposite of DESIGN_FLAG_PRESERVE, used

only for the 'About' and 'Using' notes + the icon bitmap in the icon note */

#define DESIGN_FLAG_PROPAGATE_NOCHANGE 'r' /* DESIGN: this flag is used to propagate the prohibition of design change */

#define DESIGN_FLAG_V4BACKGROUND_MACRO 'S' /* FILTER: This is a V4 background agent */

#define DESIGN_FLAG_SCRIPTLIB 's' /* FILTER: A database global script library note */

#define DESIGN_FLAG_VIEW_CATEGORIZED 'T' /* VIEW: Indicates a view that is categorized on the categories field */

#define DESIGN_FLAG_DATABASESCRIPT 't' /* FILTER: A database script note */

#define DESIGN_FLAG_SUBFORM 'U' /* FORM: Indicates that a form is a subform.*/

#define DESIGN_FLAG_AGENT_RUNASWEBUSER 'u' /* FILTER: Indicates agent should run as effective user on web */

#define DESIGN_FLAG_AGENT_RUNASINVOKER 'u' /* FILTER: Indicates agent should run as invoker (generalize the

web user notion, reuse the flag */

#define DESIGN_FLAG_PRIVATE_IN_DB 'V' /* ALL: This is a private element stored in the database */

#define DESIGN_FLAG_IMAGE_WELL 'v' /* FORM: Used with 'i' to indicate the image is an image well.

Used for images with images across, not images down.

'v' looks like a bucket */

#define DESIGN_FLAG_WEBPAGE 'W' /* FORM: Note is a WEBPAGE */

#define DESIGN_FLAG_HIDE_FROM_WEB 'w' /* ALL: notes stamped with this flag

will be hidden from WEB clients */

/* WARNING: A formula that build Design Collecion relies on the fact that Agent Data's

$Flags is the only Desing Collection element whose $Flags="X" */

#define DESIGN_FLAG_V4AGENT_DATA 'X' /* FILTER: This is a V4 agent data note */

#define DESIGN_FLAG_SUBFORM_NORENDER 'x' /* SUBFORM: indicates whether

we should render a subform in

the parent form */

#define DESIGN_FLAG_NO_MENU 'Y' /* ALL: Indicates that folder/view/etc. should be hidden from menu. */

#define DESIGN_FLAG_SACTIONS 'y' /* Shared actions note */

#define DESIGN_FLAG_MULTILINGUAL_PRESERVE_HIDDEN 'Z' /* ALL: Used to indicate design element was hidden */

/* before the 'Notes Global Designer' modified it. */

/* (used with the "!" flag) */

#define DESIGN_FLAG_SERVLET 'z' /* FILTER: this is a servlet, not an agent! */

#define DESIGN_FLAG_FRAMESET '#' /* FORM: Indicates that this is a frameset note */

#define DESIGN_FLAG_MULTILINGUAL_ELEMENT '!'/* ALL: Indicates this design element supports the */

/* 'Notes Global Designer' multilingual addin */

#define DESIGN_FLAG_JAVA_RESOURCE '@' /* FORM: Note is a shared Java resource */

#define DESIGN_FLAG_STYLESHEET_RESOURCE '=' /* Style Sheet Resource (SSR) */



#define DESIGN_FLAG_HIDE_FROM_MOBILE '1' /* hide this element from mobile clients */



#define DESIGN_FLAG_HIDE_FROM_V3 '3' /* ALL: notes stamped with this flag

will be hidden from V3 client */

#define DESIGN_FLAG_HIDE_FROM_V4 '4' /* ALL: notes stamped with this flag

will be hidden from V4 client */

#define DESIGN_FLAG_HIDE_FROM_V5 '5' /* FILTER: 'Q5'= hide from V4.5 search list */

/* ALL OTHER: notes stamped with this flag

will be hidden from V5 client */

#define DESIGN_FLAG_HIDE_FROM_V6 '6' /* ALL: notes stamped with this flag

will be hidden from V6 client */

#define DESIGN_FLAG_HIDE_FROM_V7 '7' /* ALL: notes stamped with this flag

will be hidden from V7 client */

#define DESIGN_FLAG_HIDE_FROM_V8 '8' /* ALL: notes stamped with this flag

will be hidden from V8 client */

#define DESIGN_FLAG_HIDE_FROM_V9 '9' /* ALL: notes stamped with this flag

will be hidden from V9 client */

#define DESIGN_FLAG_MUTILINGUAL_HIDE '0' /* ALL: notes stamped with this flag

will be hidden from the client

usage is for different language

versions of the design list to be

hidden completely */



#define DESIGN_FLAG_WEBHYBRIDDB '%' /* shimmer design docs */



#define DESIGN_FLAG_READONLY '&' /* for files, at least for starters */

#define DESIGN_FLAG_NEEDSREFRESH '$' /* for files, at least for now */

#define DESIGN_FLAG_HTMLFILE '&gt;' /* this design element is an html file */

#define DESIGN_FLAG_JSP '&lt;' /* this design element is a jsp */

#define DESIGN_FLAG_DIRECTORY '/' /* this file element is a directory */



#define DESIGN_FLAG_PRINTFORM '?' /* FORM - used for printing. */

#define DESIGN_FLAG_HIDEFROMDESIGNLIST '~' /* keep this thing out of a design list */



/* These are the flags that help determine the type of a design element.

These flags are used to sub-class the note classes, and cannot be

changed once they are created (for example, there is no way to change

a form into a subform). */



#define DESIGN_FLAGS_SUBCLASS "UW#yi@GFXstmzk=Kg%"



/* These are the flags that can be used to distinguish between two

design elements that have the same class, subclass (see DESIGN_FLAGS_SUBCLASS),

and name. */



#define DESIGN_FLAGS_DISTINGUISH "nw13456789"

Thursday, 6 March 2008

PrependToArray lotusscript

Sub PrependToArray( vArray As Variant, vNewValue As Variant )
' eg ... given vArray = 1,2,3,4
' vNewValue = 99
' returns 99,1,2,3,4
' The is returned in the vArray itself

%REM
' Sample call - Copy this bit to the initialize sub ========================
Dim strPreopleNamesArr(0 To 1) As String ' NOTE THAT Dim will not work, you will get an error Illegal REDIM of fixed array
strPreopleNamesArr(0) = "Mary" ' use REDIM and it works fine
strPreopleNamesArr(1) = "Jane"

Call PrependToArray( strPreopleNamesArr, "John" ) ' put the new value at the start
Print Join(strPreopleNamesArr, ", ")
' End Sample call - End of copy to initialize ===== =========================
%ENDREM

' Move all the values by 1 then add the new value at the front
Dim intIndex As Integer
Redim Preserve vArray(Ubound(vArray)+1)

For intIndex = Ubound(vArray) To 1 Step -1
vArray(intIndex)=vArray(intIndex-1)
Next
vArray(0) = vNewValue

End Sub

Tuesday, 12 February 2008

Lotus Notes View - All By Date Cat for Mail



<?xml
version="1.0" encoding="utf-8" ?>

<!DOCTYPE view
(View Source for full doctype...)>


- <view name="ATK Mail
All By Date Cat" xmlns="http://www.lotus.com/dxl" version="7.0"
maintenanceversion="2.0" replicaid="802573540034959E"
showinmenu="false" noreplace="true" publicaccess="false"
designerversion="7" unreadmarks="none" onopengoto="lastopened"
onrefresh="displayindicator" headers="simple"
opencollapsed="false" showresponsehierarchy="false"
showmargin="true" shrinkrows="false" extendlastcolumn="false"
unreadcolor="black" rowlinecount="1" headerlinecount="1"
rowspacing="1" bgcolor="white" totalscolor="black"
headerbgcolor="#c0e1ff" boldunreadrows="false"
evaluateactions="false" allownewdocuments="false"
allowcustomizations="true" hidemarginborder="false"
marginwidth="0px" marginbgcolor="white" uniquekeys="false"
useapplet="false" treatashtml="false" default="false"
private="false" defaultdesign="false" allowdocselection="false"
colorizeicons="false" direction="lefttoright"
indexrefresh="autofirstuse" indexdiscard="inactive45days"
noviewformat="false" type="standard">



- <noteinfo noteid="1de" unid="5EB72AE1874C0355802573ED003DC594" sequence="3">



- <created>



<datetime dst="false">20080212T111442,76+00</datetime>

</created>


- <modified>



<datetime dst="false">20080212T111520,32+00</datetime>

</modified>


- <revised>



<datetime dst="false">20080212T111520,31+00</datetime>

</revised>


- <lastaccessed>



<datetime dst="false">20080212T111543,66+00</datetime>

</lastaccessed>


- <addedtofile>



<datetime dst="false">20080212T111442,81+00</datetime>

</addedtofile>

</noteinfo>


- <updatedby>



<name>CN=Anthony Kendrick/OU=UK/OU=GTS/O=PwC</name>

</updatedby>


- <wassignedby>



<name>CN=Anthony Kendrick/OU=UK/OU=GTS/O=PwC</name>

</wassignedby>


- <code event="selection">



<formula>@IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 &
Form != "Group" & Form != "Person"</formula>

</code>


- <column itemname="$Sender1"
width="14.3750" resizable="true" separatemultiplevalues="false"
sortnoaccent="false" sortnocase="true"
showaslinks="false" showascolor="true" userdefinable="true"
profiledocname="ColorProfile" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="ColorColumn(Hidden)"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
time="hourminutesecond" zone="never"
dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="fourdigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
fourdigityearfor21stcentury="false" omitthisyear="false"
timeformat24="false" />


<numberformat format="fixed" digits="0" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@UserName</formula>

</code>

</column>


- <column sort="descending"
resort="descending" listseparator="comma" itemname="$116"
width="1"
resizable="true" separatemultiplevalues="true" sortnoaccent="true"
sortnocase="true" flatinr5="false" showaslinks="false"
categorized="true" twisties="true" align="left"
showasicons="false" responsesonly="false" hidden="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>dtDate:=@Date(@If(DeliveredDate != ""; DeliveredDate; PostedDate != "";
PostedDate; @Created)); strMonth := @Text(@Month(dtDate)); strMonth :=
@If(@Length(strMonth)=1; "0" + strMonth; strMonth); @Text(@Year(dtDate)) + " " +
strMonth</formula>

</code>

</column>


- <column sort="descending"
resort="descending" listseparator="comma" itemname="$115"
width="1"
resizable="true" separatemultiplevalues="true" sortnoaccent="true"
sortnocase="true" flatinr5="false" showaslinks="false"
categorized="true" twisties="true" align="left"
showasicons="false" responsesonly="false" hidden="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@Date(@If(DeliveredDate != ""; DeliveredDate; PostedDate != "";
PostedDate; @Created))</formula>

</code>

</column>


- <column align="center"
resort="ascending" resort2="descending" resort2column="14"
itemname="$109" width="1.5000" resizable="true"
separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" hidecolumntitle="true"
hideinr5="true" hidden="true" showasicons="true"
responsesonly="false" twisties="false"
categorized="false" showascolor="false" userdefinable="false"
readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" />

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
fourdigityearfor21stcentury="true" time="hourminutesecond"
zone="never" dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="fourdigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


- <code event="value">



<formula>REM {DNT}; nFollowUpSet :=
@If(@IsAvailable(FollowUpStatus);@TextToNumber(FollowUpStatus);
!@IsAvailable(FollowUpStatus) & @IsAvailable(FollowUpDate) &
FollowUpDate != ""; 2; 0); nPriority := @Text(nfollowupset);
@If(@IsError(nFollowUpSet); ""; nFollowUpSet = 0; ""; nFollowUpSet = 1; 181;
nFollowUpSet = 2; 182; nFollowUpSet = 3; 183; "")</formula>

</code>


- <code event="hidewhen">



<formula>REM { Test if this is version 6.1 of Notes and 6.1 of the template};
OkToShow := @If(@Version < @Text(192); 0; @HasFeature("650Lic"); 1; 0);
OkToShow != 1 | @IsError(OkToShow)</formula>

</code>

</column>


- <column align="center"
listseparator="comma" itemname="$93"
width="3"
resizable="false" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" showasicons="true"
responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="true" parens="false" percent="true" />


- <code event="value">



<formula>REM {This icon formula is used in ($Inbox) folder, (MailThreads) view,
and ($All) view}; CSisPrivate := @If(@IsUnavailable($PublicAccess) &
@IsAvailable($CSVersion);"1";"0"); isImportant := @If(Importance="1";"1";"0");
ViewIcon2 := @If(_ViewIcon = 158 & AppointmentType != "1" & BookFreeTime
= "1"; 12; _ViewIcon); tmpIcon := @If(ExpireDate !="" ;64;displaycopyto_icon =
"1";"sentto.gif"; @If(DeliveredDate = ""; @If(PostedDate="" |
@IsUnavailable(PostedDate); @If(@IsAvailable(IsMailStationery); 21;
@IsAvailable(_ViewIcon); ViewIcon2; 58); @If(IsImportant="1"; 124; 122));
@IsAvailable(_ViewIcon); ViewIcon2; $TypeIcon)); REM; "If the Task has no icon,
display the invitation icon - backward compatibility"; varTaskIcon := @If(Form =
"Task" & (!@IsAvailable(_ViewIcon) | ViewIcon2 = "") &
(!@IsAvailable(_ViewIcon2) | ViewIcon2 = ""); @False; @True); iconOne :=
@If(!varTaskIcon; 133; @If(tmpIcon = ""; 0; tmpIcon)); iconTwo :=
@If(iconOne=124;0;CSisPrivate="1"; 164; isImportant="1"; 150; 0);
iconOne:iconTwo</formula>

</code>

</column>


- <column itemname="$114"
width="2"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" showasicons="true"
align="left" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt"
style="bold" />

</columnheader>


- <code event="value">



<formula>@If(FiledToDMS="1";2;0)</formula>

</code>

</column>


- <column itemname="SametimeInfo"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader title="SametimeInfo"
align="left" readingorder="lefttoright">



<font size="9pt" />

</columnheader>


- <code event="value">



<formula>SentBy := @If(Principal = ""; From; Principal); Attendees :=
@Trim(RequiredAttendees : OptionalAttendees); Who := @If(DeliveredDate != "";
SentBy; @Elements(Attendees) > 0; @Subset(Attendees; 1); SendTo = ""; SentBy;
@Subset(SendTo; 1)); CN1 := @Trim(@Name([Abbreviate]; Who)); CN :=
@If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G := @If(CN
= ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S]; Who));
""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report";
"Mail Router"; Person2)</formula>

</code>

</column>


- <column resort="ascending"
resort2="descending" resort2column="14"
listseparator="comma" itemname="$102"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" align="left"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Who"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


<columnnamesformat showonline="true" columncontainsname="true"
columnname="SametimeInfo" verticalorientation="top" />


- <code event="value">



<formula>SentBy := @If(Principal = ""; From; Principal); Attendees :=
@Trim(RequiredAttendees : OptionalAttendees); Who := @If(DeliveredDate != "";
SentBy; @Elements(Attendees) > 0; @Subset(Attendees; 1); SendTo = ""; SentBy;
@Subset(SendTo; 1)); CN1 := @Trim(@Name([CN]; Who)); CN :=
@If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G := @If(CN
= ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S]; Who));
""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report" ;
"Mail Router"; Person2)</formula>

</code>


- <code event="hidewhen">



<formula>TemplateLang := "en"; @If(@ClientType = "Notes";
@LocationGetInfo([NamePreference]) = "1"; @False)</formula>

</code>

</column>


- <column resort="ascending"
resort2="descending" resort2column="14"
listseparator="comma" itemname="$107"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" hideinr5="true"
hidden="true" align="left" showasicons="false"
responsesonly="false" twisties="false"
categorized="false" showascolor="false" userdefinable="false"
hidecolumntitle="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Who"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


<columnnamesformat showonline="true" columncontainsname="true"
columnname="SametimeInfo" verticalorientation="top" />


- <code event="value">



<formula>REM {This column is an alternative column for alternate names}; REM
{The variable TemplateLang should much the language of the template.}; REM {For
example, en for English, de for German, and ja for Japanese.}; REM {The variable
in the hide column when formula in both Who columns should be same.};
TemplateLang := "en"; bUseAltName := @IsMember($LangFrom; TemplateLang);
bUseAltPrincipal := @IsMember($LangPrincipal; TemplateLang); bUseAltSendTo :=
@IsMember($NameLanguageTags; TemplateLang); tmpFrom := @If(bUseAltName &
(AltFrom != "") & (AltFrom != From); AltFrom; From); tmpPrincipal :=
@If(bUseAltPrincipal & ($AltPrincipal != "") & ($AltPrincipal !=
Principal); $AltPrincipal; Principal); tmpSendTo := @If(bUseAltSendTo &
(@Elements(AltSendTo) > 0) & (AltSendTo != SendTo); AltSendTo; SendTo);
SentBy := @If((Principal = "") | (Principal = From); tmpFrom; tmpPrincipal);
Attendees := @Trim(RequiredAttendees : OptionalAttendees); Who :=
@If(DeliveredDate != ""; SentBy; @Elements(Attendees) > 0; @Subset(Attendees;
1); SendTo = ""; SentBy; @Subset(tmpSendTo; 1)); CN1 := @Trim(@Name([CN]; Who));
CN := @If(@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1); G :=
@If(CN = ""; @Trim(@Name([G]; Who)); ""); S := @If(CN = ""; @Trim(@Name([S];
Who)); ""); Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S;
@Trim(X400FreeForm)); Person2 := @If(@Left(Person;1)="\"" &
@Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person); @If(Form =
"Delivery Report" : "NonDelivery Report" : "Trace Report" : "Quota Report" ;
"Mail Router"; Person2)</formula>

</code>


- <code event="hidewhen">



<formula>TemplateLang := "en"; @If(@ClientType = "Notes";
@LocationGetInfo([NamePreference]) != "1"; @True)</formula>

</code>

</column>


- <column resort="ascending"
itemname="$111" width="1.3750" resizable="true"
separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidecolumntitle="true"
showasicons="true" align="left" responsesonly="false"
hidden="false" twisties="false" categorized="false"
showascolor="false" userdefinable="false" hideinr5="false"
readingorder="lefttoright">



- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" />

</columnheader>


<numberformat format="general" digits="varying"
punctuated="false" parens="false" percent="false" />


- <code event="value">



<formula>rfNum := @Text($RespondedTo); @If(rfNum = "1"; 178; rfNum = "2"; 179;
rfNum = "3"; 180; "")</formula>

</code>

</column>


- <column sort="ascending"
resort="descending" listseparator="comma" itemname="$68"
width="8"
resizable="true" separatemultiplevalues="false" sortnoaccent="true"
sortnocase="true" showaslinks="false" align="left"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Date"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="date" date="yearmonthday" fourdigityear="true"
time="hourminute" zone="never" dateformat="weekdaymonthdayyear"
dayformat="twodigitday" monthformat="twodigitmonth"
yearformat="twodigityear" weekdayformat="shortname"
dateseparator1="" dateseparator2="/" dateseparator3="/"
timeseparator=":" showtodaywhenappropriate="false" fourdigityearfor21stcentury="false"
omitthisyear="false" timeformat24="false" />


<numberformat format="general" digits="2" punctuated="false"
parens="false" percent="false" />


- <code event="value">



<formula>@If(DeliveredDate != ""; DeliveredDate; PostedDate != ""; PostedDate;
@Created)</formula>

</code>

</column>


- <column align="right"
sort="ascending" resort="descending" itemname="$106"
width="5.6250" resizable="true" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
showasicons="false" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Size"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


<datetimeformat show="datetime" date="yearmonthday"
time="hourminutesecond" zone="never"
dateformat="weekdaymonthdayyear" dayformat="twodigitday"
monthformat="twodigitmonth" yearformat="twodigityear"
weekdayformat="shortname" dateseparator1=""
dateseparator2="/" dateseparator3="/" timeseparator=":"
showtodaywhenappropriate="false" fourdigityear="false"
fourdigityearfor21stcentury="false" omitthisyear="false"
timeformat24="false" />


<numberformat format="general" digits="varying"
punctuated="true" parens="false" percent="false" />


- <code event="value">



<formula>@If( @IsDocTruncated; @If(@TextToNumber(@Version) < 172; @DocLength;
@DocOmittedLength + @DocLength); @DocLength)</formula>

</code>

</column>


- <column align="center"
itemname="$105" width="2" resizable="false" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
showasicons="true" responsesonly="false" hidden="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader align="left"
readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


- <code event="value">



<formula>@If(@TextToNumber(@Version) > 122; @If(@IsAvailable(_ViewIcon2);
_ViewIcon2; @Contains(@LowerCase(@AttachmentNames); "smime.p7s"); 12;
@Contains(@LowerCase(@AttachmentNames); "smime.p7m"); 61; @IsDocTruncated; 30;
@IsAvailable($ContentIcon); $ContentIcon; (@Contains(@LowerCase(From); " pager
") | @Contains(@LowerCase(SendTo); " pager ")); 46; @Attachments;
@If(@Contains(@LowerCase(@AttachmentNames); "message.wav" : "vmsg_hdr.wav"); 44;
@Contains(@LowerCase(@AttachmentNames); ".wav"); 15;
@Contains(@LowerCase(@AttachmentNames); ".tif"); 47; 5); 0);
@IsAvailable($ContentIcon); $ContentIcon; @Attachments; 5; 0)</formula>

</code>

</column>


- <column itemname="$74"
width="49.2500" resizable="true" separatemultiplevalues="false"
sortnoaccent="true" sortnocase="true" showaslinks="false"
align="left" showasicons="false" responsesonly="false"
hidden="false" twisties="false" categorized="false"
showascolor="false" userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



<font size="9pt" />


- <columnheader title="Subject"
align="left" readingorder="lefttoright">



<font size="9pt" name="multilingual"
/>

</columnheader>


- <code event="value">



<formula>@If( form = "NonDelivery Report" & (!@IsAvailable(SMTPDSNType) |
SMTPDSNType = "0"); "DELIVERY FAILURE: " + FailureReason; form = "NonDelivery
Report" & @IsAvailable(SMTPDSNType) & SMPTDSNType != "0"; "DELIVERY
NOTIFICATION: " + FailureReason; Form = "Delivery Report"; "DELIVERED: " +
Subject; Form = "Return Receipt"; "RECEIVED: " + Subject; Form =
"ReturnNonReceipt"; "NOT RECEIVED: " + Subject; Subject)</formula>

</code>

</column>


- <column itemname="$113"
width="10"
resizable="true" separatemultiplevalues="false" sortnoaccent="false"
sortnocase="true" showaslinks="false" hidden="true"
align="left" showasicons="false" responsesonly="false"
twisties="false" categorized="false" showascolor="false"
userdefinable="false" hidecolumntitle="false"
hideinr5="false" readingorder="lefttoright">



- <columnheader title="$ExchangeMigRequireAddrFixUp" align="left" readingorder="lefttoright">



<font size="9pt"
style="bold" />

</columnheader>


- <code event="value">



<formula>@If( @IsAvailable($ExchangeMigRequireNameFixup);
$ExchangeMigRequireNameFixup; "2")</formula>

</code>

</column>


- <item name="$FormatNote"
summary="true" sign="false" seal="false"
sealed="false" authors="false" names="false"
readers="false" placeholder="false">



<rawitemdata
type="4">AQDLtLkShfEiYdlTXAC0cyWA</rawitemdata>

</item>

</view>


Monday, 10 December 2007

My on Error in LotusScript Agents


ExitNow:


Exit Sub

HandleError:

Dim strNewLineChar As String

Dim atkDb As NotesDatabase
Dim atkSession As New NotesSession()
Dim strErrMessage As String

strNewLineChar = Chr(13) + Chr(10)
If Not atkSession.CurrentAgent Is Nothing Then
strErrMessage = strErrMessage + "While running the agent named ["+_
atkSession.CurrentAgent.Name +"]" + strNewLineChar

strErrMessage = strErrMessage + " under the username ["+_
atkSession.CurrentAgent.OnBehalfOf +"]" + strNewLineChar

strNewLineChar = strNewLineChar + "
"

End If

strErrMessage = strErrMessage + "There has been an error encountered in the database with the title [" + _
atkSession.CurrentDatabase.Title + "]" + strNewLineChar + " on the server [" + _
atkSession.CurrentDatabase.Server + "] at the file location [" +_
atkSession.CurrentDatabase.FilePath + "]" + strNewLineChar

strErrMessage = strErrMessage + "The session username is ["+_
atkSession.username +"]" + strNewLineChar


strErrMessage = strErrMessage + "The error occurred at " + strNewLineChar + _
"Line number "+ Cstr(Erl) + strNewLineChar + _ ' Current line number (in the LS source)
"Function Name " + Lsi_info(2) + strNewLineChar + _ ' The current function or sub
"Module " + Lsi_info(3) + strNewLineChar + _ ' The current module
"Caller function: " + Lsi_info(12) + strNewLineChar +_ ' The name of the function that called this one, "the caller"
"The error code is " + Cstr(Err) + strNewLineChar +_
"The error message is " + Cstr(Error)


Print strErrMessage
Goto ExitNow
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.




NameDescriptionType
Err Numeric error code integer
Error Error text string
GetThreadInfo(LSI_THREAD_LINE) Current line number variant
GetThreadInfo(LSI_THREAD_PROC) Current procedure variant
GetThreadInfo(LSI_THREAD_MODULE) Current module variant*
GetThreadInfo(LSI_THREAD_VERSION) Lotusscript version variant
GetThreadInfo(LSI_THREAD_LANGUAGE) Language setting variant
GetThreadInfo(LSI_THREAD_COUNTRY) Country/Region setting variant
GetThreadInfo(LSI_THREAD_TICKS) Current clock ticks variant
GetThreadInfo(LSI_THREAD_TICKS_PER_SEC) Clock ticks per second variant
GetThreadInfo(LSI_THREAD_PROCESS_ID) Current process ID variant
GetThreadInfo(LSI_THREAD_TASK_ID) Current task ID variant
GetThreadInfo(LSI_THREAD_CALLPROC) Calling procedure variant
GetThreadInfo(LSI_THREAD_CALLMODULE) Calling module variant
Lsi_info(1) Current line number string
Lsi_info(2) Current procedure string
Lsi_info(3) Current module string
Lsi_info(6) Lotusscript version string
Lsi_info(9) Language setting string
Lsi_info(12) Calling procedure string
Lsi_info(50) LS memory allocated string
Lsi_info(51) OS memory allocated string
Lsi_info(52) LS blocks used string

* = this call returns a hex code, not the module name

Note:To use the GetThreadInfo constants, you must include LSPRVAL.LSS, which is automatically included through LSCONST.LSS