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)

Indeed, should you want to do arithmetic with such a field, an empty value -- which conventionally Lotus Notes stores as string "" rather than numeric NULL -- will generate an error. But that should be expected. You don't have a numeric value present, and if "" should be interpreted arithmetically as zero, then zero should actually be the value stored.

Inputting values
Next is the issue of inputting, accepting and storing a value. If the end-user is expected to enter a numeric value -- something that the application will do arithmetic with -- then give users a numeric field to enter it.

Lotus Notes, along with just about everything else, will deal with parsing the set of characters typed into the field into something that can be stored as a number. It will deal with all the keyboard characters that could be typed, and also when valid characters in invalid sequences are entered, it will handle them too.

An example of that is entering two or more periods in a numeric field -- assuming you use the US/UK convention on numeric entry, that is. Our European cousins use a comma as the decimal divider and periods as numeric separators, and Notes and Windows deal with that transparently for them, and us.

This all means that by the time the entered value gets stored, or is passed to any field validation or translation formula you might write, it will be a number value. The one exception to this is that Lotus Notes will accept no entry as a valid value for a number field, but will then store the value as text "", which won't help subsequent arithmetic operations. In such a case, add the following as a translation formula:

@if(@thisvalue = "";0;@thisvalue)

This will ensure that if no value is entered, a zero will be stored. Subsequent arithmetic operations will be safe, except of course a divide-by-zero operation. You will, of course, have made provisions for possible zero divide situations, won't you?

Type conversion
There's another good reason to keep arithmetic field values in numeric fields rather than in text, and that's type conversion. Type conversion is inherently slow, because it has to be able to take any possible value from the source field and convert it to the target. That's a complex operation, particularly if the source is of string or text type, because of all the characters that could be in the field value.

So if we have to do it, it's best to do it once, at the point that the value first appears as a non-numeric value into the application, which in itself tends to be at the point of initial data entry. And at that point, as we have just seen, Lotus Notes will do the data validation for you anyway.

But if you can't avoid type conversion in your application, you must remember that you need to guard against source values that cannot be converted to numeric. You also need to take into account those that can be converted, but have values too big for the numeric type you are using. You must also supply a default value when the conversion fails.


« 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