Search DominoPower's 11,433 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.
Numeric vs. text fields in application design (continued)

Much better is to make sure that this situation does not and can not arise by making sure that the data values are stored in numeric fields to begin with. You can see the scale of the issue of data conversion in Lotus Notes merely by looking at the huge range of data type checking and conversion built-in functions that exist in the Formula and LotusScript languages. Better than using them, avoid the whole need by storing the data in the right data type to begin with.

When users use your application
And of course, the best reason for determining that what appears to be a "number" is actually a text field will come when the business wants to store a value in it that isn't a number -- which, inevitably will happen after you've gone into production and not in testing.

Imagine that someone decided that the best way to store a telephone number is in a numeric field. It's a number, after all? And then your company decides that it is going overseas or into Europe, so phone numbers now need to be stored in international format. +44 (0) 1234 567890 isn't going to work in a number field and if it's then stored as 441234567890, it won't be easy for your users to read. I've yet to see a reason for doing arithmetic on telephone numbers. Do let me know if you can find one.

Using numeric fields is not without its dangers, however. Particularly in LotusScript it is all too easy to:

dim counter as integer

What's the problem with that? What if you forget that an integer can only cope with a maximum value of 32767? That one usually comes home to roost about a week after going in to production. Calculating time differences in seconds via NotesDateTime.TimeDiff will in the end catch you out, when the resulting value is more than can be put into a Single type variable. And I suspect that using Currency as a display type in Notes applications still catches people out when their application crosses into another country for the first time, and you learn that 1.00 UK pound is not remotely the same value the same as $1.00US or even 1.00 Euro.

Then there's the sorting issue, which does start, unless carefully handled, to blur the whole issue of numbers as arithmetic values or as strings that contain numeric characters. I have lost track of the number of times that I have seen Notes views which are mis-sorted, because the programmer expects that a number represented in text will sort as its numeric value would indicate it would.

But even this expectation comes down to what exactly the field value represents. Numbers are sorted by their numeric value; 1 before 2, and 9 before 10. However, if these were sorted as a string value, 1 would be before 2, but 10 would be between them. That's because string values are sorted character by character, left to right.

But, I can hear you saying that you actually want documents in a view sorted by some sort of ascending key -- a record or document number. And that the only way to sort such a list properly is by, well, numbering them in a numeric sequence.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > Notes (84 articles)
   A walk down Memory Lane with Lotus Notes
   An application for scanning physical mail and distributing it virtually
   Managing Notes deployments with Teamstudio Build Manager
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
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
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
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
How not to crash in LotusScript
IBM Lotus to Google Apps Migration Remorse
Webcast Series: Mobile Collaboration with Lotus Software
Domino Login Control for Mobile Apps
>> 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