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.
Tips and tricks in LotusScript (continued)

The first line looks up the value in field doc.subject(0) in the array printerprofdoc.printer_name and returns the subscript value where it was found, or Null if not. I can then use that returned value to look up the corresponding location and site names in the profile. Simple, and neat.

Date formatting
PL/1, and for that matter IMS, didn't have the concept of a date field; we had to do actions on dates either as strings, or as numbers. And while DB2 has date fields, the external representation of them was in string variables--languages such as PL/1 didn't have date-type variables. We created some neat solutions for dealing with dates as strings and numbers and manipulating them in various ways to reformat them. We also had solutions to do date arithmetic, such as the difference between two dates.

Now that we have the concept of date field types in Notes and in LotusScript, we don't often have to do the sorts of manipulations that we had to do because the language constructions do them for us, and they make sure that the result is still a valid date. But all is not sweetness and light, because instead, we have the issue of dealing with the fact that when a Notes date value is created in LotusScript, the actual date that gets created depends on the date format that the machine's operating system is running with. For those of us in Europe, this matters.

Consider the date 01/02/2003. To Americans, it's January 2. To Europeans, it's February 1.

Now consider the code:

dim NotesDate as new notesdatetime("01/02/2003")

If the machine that runs this is running U.S. date format, then NotesDate will have the value January 1. If the format is European, it will be February 2. But if you offer it 21/01/2003, it will correctly parse it as 21 January, because that is the only value that can be parsed from 21/01/2003. So why does this matter, supposing you know what the machine's date format is?

It matters a bit if you run the code on a server, especially on NT4. This is because NT4 sporadically, all by itself, changes the date format to U.S., if running in European format. It doesn't tell you it's done it, but you can see it in the log, where the date format can change in the middle of a log segment. And I've seen this happen on AIX servers, as well. Go look at Knowledgebase entry 182329 for an example of this on NT.

If the code runs on workstations, this is a big issue, because workstations are controlled by users, who are capable of anything. And, of course, while your server is in Europe, your user may be in the U.S. and legitimately be using a U.S. date format.

So you can't rely on dim NotesDate as new notesdatetime("01/02/2003"), even if you make up the string yourself by breaking a date up and reassembling it, because even when you know which is month and which is day, Notes might not agree with you.

But there is a simple trick that works every time. This is to break the date string you have up into the Day, Month, and Year parts and make a Variant out of it with DateNumber:


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
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