Q
Problem solve Get help with specific problems with your technologies, process and projects.

Keeping an editable number field blank in a Lotus Notes document

SearchDomino.com expert Cregg Hardwick explains how to keep an editable number field blank (not zero) when a user edits a Lotus Notes document.

How do I zero suppress, or leave number fields blank if no numbers are entered by the user on a Lotus Notes-based form. I don't know LotusScript very well, but I sure could use your help with this. How do you keep an editable number field blank if no numbers are entered by the user? I want to have it show U.S. dollars only if a value is entered.

If I understand you correctly, I would not use LotusScript at all. Let's say you have a document containing a numeric field called "Dollars." You want the field to appear blank (not zero) when the user edits the Lotus Notes document. You could just add an input translation formula to the dollars field like this:

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

Of course, this will change the value of the field if the document is saved. However, in Lotus Notes, you should be designing all views, agents, etc., to expect numeric fields to sometimes have a null string value, since that's what Formula language returns when you access an uninitialized field.

But, if that's not possible, you could create a "shadow" editable field and make "dollars" hidden so that "dollars" actually gets updated only if the shadow field is changed.

To detect when a field changes, use another hidden "check" field. Place a hidden, "computed for display" check field at the bottom of the form with its value set to its own name. Then add code (either Formula language or script) to the form's post-recalc event that detects when this check field and your editable shadow field have different values, and sets the dollars field and the check field appropriately.


Do you have comments on this Ask the Expert Q&A? Let us know.

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close