Ask the Expert

Keeping an editable number field blank in 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.

This was first published in May 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: