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 fieldYou 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
Related Q&A from Andre Guirard
Learn how you can use LotusScript and OLE to create and populate Microsoft Excel spreadsheets, as well as a little bit about Lotus Symphony. Continue Reading
Discover options you can use if you'd like external users to be able to access a workflow-based Notes Domino application through different ... Continue Reading
Learn why you may receive the error message: "Illegal circular use: Audit Trail" when trying to open Lotus Notes documents that use copied forms. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.