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

Suppressing zeros in a form

How can I suppress zeros from showing in a number field on a form that is used as a company expense form? The accounting department doesn't want to see zeros when they verify the math after a user has routed the form to them via e-mail. How do you tell Domino you're using a number field, but keep the users from seeing any numbers IF those fields are left blank?
Your question raises several issues.

First of all, why does the accounting department need to verify the math? Computers are very good at math. If there's a value on the form that you can calculate for the user, do so and save someone the trouble of checking the value.

Blank is not the same as zero, generally speaking. When the user edits the form, they can enter 0 or leave the field blank. If you would prefer them to leave the field blank if the value is zero, you could enforce that with an input translation formula:

@If(@ThisValue = 0; ""; @ThisValue) 
Of course you have to take that into account if you have formulas that do math on these values, with formulas such as:
total := @If(line1 = ""; 0; line1) + @If(line2 = ""; 0; line2) + ... 
If you need to preserve the distinction between zero and blank for the original user's sake, but display blanks instead of zeroes when someone else views the form, you can use hide formulas and CFD fields that display the appropriate value to the viewer. For instance, you have a field named WeeklyHours in which the user might enter 0 or leave blank, then you might add a field named WeeklyHours_d on a different paragraph, with a formula such as: @If(WeeklyHours = 0; ""; WeeklyHours)

Then you must set hide attributes for the paragraphs containing both fields to make them display in the right circumstances. The easiest path is to make one display in edit mode and one in read mode. But if you need to, you can also choose which to display based on the identity of the user. For example, if you record the original username in the field "Computed when composed" field OriginalAuthor and you want to display the editable field only to that person, then you would use the following hide formulas:

@UserName != OriginalAuthor -- for the editable field 
@UserName = OriginalAuthor -- for the CFD field 
You can also hide things based on a user's role or group memberships by using the @UserRoles or @UserNamesList functions. However, if you do that, watch out for the following:
  • These functions don't work in a local replica unless you enable the "Consistent access control" option in the database ACL dialog.

  • Since the functions typically return a multivalue result, be careful using !=. For example, if @UserRoles returns "[Accounting]" : "[Editors]", then the expression @UserRoles != "[Accounting]" is TRUE because one of the list members -- [Editors] -- does not equal [Accounting]. Instead use !(@UserRoles != "[Accounting]").

  • You may need to take into account that someone in accounting may need to originate one of these documents. Obviously they must then be able to view the fields that you are hiding.

  • @UserNamesList and @UserRoles are expensive functions, so you shouldn't evaluate them multiple times on a form. Use a CFD field at the top of the form to find out what you need to know about their identity. Following the example, it might be a number field called IsAccounting, with this formula: @If(@IsDocBeingLoaded; @ThisValue; @UserRoles = "[Accounting]"). Thereafter you can use IsEditable in hide formulas instead of calling @UserRoles again.

Dig Deeper on Lotus Notes Domino Administration Tools

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close