Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Getting the Domino server time with @Now (continued)

So, we raised a PMR with IBM. We were not the first to report the issue; there was already an SPR issues, and, better, it was to be available in Notes 7.0.3, which was to be delivered within a couple of weeks. Do note that while the fix is also in 8.0.1 and above, timing meant that it is not in 8.0, which came out before 7.0.3. The fix is to add a new flag value of [NoCache], which when used, forces a server clock lookup regardless of whether the time has already been cached -- and the fix list suggests that there was in fact an error in the existing implementation:

SPR# KYOE69T7F3 - Fixed a cache algorithm issue. By adding [NoCach] on the @now call, @now can be consistent by pulling the right values each time.

Do beware: the correct value of the flag is NoCache, not as noted above in the quote.

That fix worked as we expected, but of course then we ran into downward-compatibility issues. You cannot code that @function directly on Notes 7.0.2 or 8.0; they complain that the syntax is wrong. If you then code it with 7.0.3 or 8.0.1, it won' t run anywhere else. Which was a new issue we needed to work round.

Here are a couple of examples of using this new parameter:

FIELD ServerOnly:= @Now([NoCache]:[ServerTime];Server);

This statement will only work on 7.0.3 and 8.0.1, and will return the current clock value for the server named in field Server, or, if that's not accessible, an error.

FIELD ServerLocal :=@Now([NoCache]:[ServerTime]:[LocalTimeOnError];Server);

This version also works only on 7.0.3 or 8.0.1, but will always return a clock value. Note that if the field Server has multiple values, you'll get multiple clock values returned.

Now that was all very well, but @Now's LotusScript equivalent -- Now() -- doesn't have these extra flags, not even in 8.0.1. I could not find a way to store the keywords in formula language, and make them work; it seems that the [square bracket] keyword values only work when specified directly in the formula and can't be stored in variables. That, and the complexity of what we actually wanted to do was pointing me towards LotusScript.

The next thing I did was to write a quick piece of LotusScript to test out the issues. It's in a form button that populates 3 fields on the form; two from @Now, and one from the LotusScript Now() local value to act as a comparison. Actually, the database that this is part of was first put together as we started to explore the issues, and it was passed to Lotus as part of the PMR submission to explain the issue. Once we had the fix, it was extended with this LS code so that we could be sure how to make it work before altering the production application.

Sub Click(Source As Button)
Dim sess As New notessession
Dim db As notesdatabase
Set db = sess.CurrentDatabase
5 Dim wk As New notesuiworkspace
Dim uid As notesuidocument
Dim doc As notesdocument
Set uid = wk.currentdocument
Set doc = uid.Document
10 Dim buildno As Integer
buildno = sess.NotesBuildVersion
Dim notesver As String
Select Case buildno
Case 266: notesver = "Notes 7.0.3"
15 Case Is < 266: notesver = "Notes 7.0.2. or below"
Case 307: notesver = "Notes 8.0"
Case Is > 307: Notesver = "Notes 8.0.1 or later"
Case Else: notesver = "Can't Tell"
End Select
20 Dim timevar As Variant
Dim timevar1 As Variant

If buildno = 266 Or buildno > 307 Then 'Notes 7.0.3 or 8.0.1
timevar = Evaluate(|@now([NoCache]:[ServerTime]:[LocalTimeOnError];"| & doc.server(0) & |")|)
25 timevar1 = Evaluate(|@now([NoCache]:[ServerTime];"| & doc.server(0) & |")|)
Else
timevar = Evaluate(|@now([ServerTime]:[LocalTimeOnError];"| & doc.server(0) & |")|)
timevar1 = Evaluate(|@now([ServerTime];"| & doc.server(0) & |")|)
End If
30 If Not Isempty(timevar) Then
Dim dt As New NotesDateTime(timevar(0))
doc.serverlocal = dt.LSLocalTime
Else
doc.serverlocal = ""
35 End If
If Not Isempty(timevar1) Then
Dim dt1 As New notesdatetime(timevar1(0))
doc.serveronly = dt1.lslocaltime
Else
40 doc.serveronly = ""

End If

Dim dtnow As New notesdatetime(Now)
45 doc.localtime = dtnow.LSLocalTime

doc.notesver = notesver

End Sub


« Previous  ·  1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Lotus Technologies > Domino (77 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   Sloppy analysis at the core of another Domino vs. SharePoint report
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Home > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.

Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.

Learn how to easily clean up your address book.

-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login