Lotus Notes — рабочий инструмент программиста.

Обсуждения программирования на Lotus Notes/Domino

Archive for Октябрь 27th, 2008

Immediate If

без комментариев

Function IIf (condition As Variant, trueCondition As Variant, falseCondition As Variant) As Variant
‘ such a basic function for all other programming languages … stands for "Immediate IF"
‘ written by Mike Mortin
If condition Then
If Isobject(TrueCondition) Then
Set IIf = trueCondition
Else
IIf = trueCondition
End If
Else
If Isobject(TrueCondition) Then
Set IIf = falseCondition
Else
IIf = falseCondition
End If
End If
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

Get all the servers in a cluster

без комментариев

Function GetClusterServers(server As String, getAllServers As Boolean) As Variant
Dim s as New NotesSession
Dim cluster As String
Dim serverDoc As NotesDocument
Dim serverName As NotesName
Dim key(1 To 2) As Variant
Dim navdoc As NotesViewEntry
Dim nav As NotesViewNavigator ‘ define domain and name as per the default "Servers" view
Set serverName = New NotesName(server)
key(1) = serverName.Organization
key(2) = serverName.Abbreviated
Set serverDoc = GetDocFromDb(s.CurrentDatabase, "Servers", key, True) ‘ get a list of servers in the same cluster
cluster = serverDoc.ClusterName(0)
Set nav = GetCategoryDocsFromDb(currentDb, "Clusters", cluster) ‘ go through the category, add names to replica list
Set navdoc = nav.GetFirstDocument()
While Not navdoc Is Nothing
Set serverDoc = navdoc.Document
If serverDoc.ServerName(0) <> server Or getAllServers Then
Set serverName = New NotesName(serverDoc.ServerName(0))
GetClusterServers = GetClusterServers & serverName.Abbreviated & ","
End If
Set navdoc = nav.GetNextDocument(navdoc)
Wend ‘ tighten up the list
GetClusterServers = Split(GetClusterServers, ",")
GetClusterServers = Fulltrim(GetClusterServers)
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

grab category docs from a database ( shorten your code )

без комментариев

Function GetCategoryDocsFromDb( db As NotesDatabase, viewName As String, category As String ) As NotesViewNavigator
‘ returns all docs from a given category
‘ written by Mike Mortin Dim view As NotesView ‘ get the view
Set view = db.GetView(viewName) ‘ get the docs from the cateogry
Set GetCategoryDocsFromDb = view.CreateViewNavFromCategory( category )
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

grab a document from a database ( shorten your code )

без комментариев

Public Function GetDocFromDb( db As NotesDatabase, viewName As String, key() As Variant, exact As Boolean ) As NotesDocument
‘ returns the first doc based on a search key
‘ written by Mike Mortin
Dim view As NotesView ‘ get the view
Set view = db.GetView(viewName) ‘ get the doc from the key
Set GetDocFromDb = view.GetDocumentByKey(key, exact)
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

returns a date the document/email should be considered created

без комментариев

Public Function GetEmailCreatedDate(doc As NotesDocument) As String
‘ returns a date the document/email should be considered created
‘ written by Mike Mortin 20080625
If doc.DeliveredDate(0) <> "" Then
GetEmailCreatedDate = doc.DeliveredDate(0)
Elseif doc.PostedDate(0) <> "" Then
GetEmailCreatedDate = doc.PostedDate(0)
Else
GetEmailCreatedDate = doc.Created
End If
End Function

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

Enabling Drag and Drop on a Calendar in a Browser

без комментариев

Написано lotusnotes

Октябрь 27, 2008 в 10:01

Опубликовано в Lotus Notes

Dashboard example (realtime data into graphs using RMchart)

без комментариев

In this sample application I show you how you can use RMcharts in an Lotus Notes Dashboard application. You need to download RMchart at http://www.rmchart.com/ and install it on your PC (a restart is required). Make sure the files RMchart.ocx and RMchart.dll are installed in your windows\system32 directory. RMchart is completely freeware. Go to the website for more information. I created this application because I could not find any free product to create realtime graphs from (view) data within Lotus Notes. Finally I found this software and this made my work a lot easier. No more excel and no more exports needed. This is a completly free solution and I think it works great. If you would like to use RMcharts in a real application make sure your users have the RMcharts installed. You could copy above files manualy or automatic via an script to windows\system32\ directory and use ‘regsvr32′ command line program to register the .ocx file in Windows. This database contains a view for the sales sample data and a lookup view I use to quickly & dynamic get the values to display in the charts. The dashboard form contains the embedded activex elements and all the code I used to get the data and display the data in the embedded activex elements. It makes use of a script library for the needed constants. TIP: You can build your own charts with RMCdesigner, also available at www.rmchart.com. Use the program to generate source code for VB6 / ActiveX and paste it in an Lotus Notes button in a form. With very limited changes you can use that generated code in your application. If you have any questions regarding this application, mail me. Ferry Kranenburg

Original source : http://www.openntf.org/projects/codebin/codebin.ns…

Написано lotusnotes

Октябрь 27, 2008 в 10:00

Опубликовано в Lotus Notes