Expert Answer Center > Experts On Demand > View Answer
EMAIL THIS
Experts on Demand
  EXPERTS ON DEMAND HOME     POSE A QUESTION     VIEW ANSWERS     BROWSE BY TOPIC        RSS FEEDS  
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? QUESTION POSED ON: 23 FEB 2005
QUESTION ANSWERED BY: Andre Guirard 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.
HomeExperts on DemandIT Expert Webcast SeriesExpert KnowledgebaseSite Index
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts