Simple questions about the formula language

Value ""
What does it mean, and when should I use it ?
Displaying Icon
if@(OrdStatus = Confirmed;83;0)
It shows no error when I using it, but it doesn't work the way I want. Why?
OrdStatus  is a field and can set to Confirmed.
Editing Field
There is a form that everybody should edit, except one field on it. This one field should be displayed.
But there is a person who should be able to edit this field, too.
I don't want to hide it.
How can I set a field for displaying but allow one person to edit it ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This is an empty string. It's used widely.
E.g. to supress errors in @DbLookup:
   @If(@IsError(Lst); ""; Lst)
Also in @DbLookup itself: "" could refer to "local" (not on a server), or to the "current database".
Or to clear a fields value:
   field myFieldName := ""

I assume OrdStatus is a field.
If  Confirmed is one of its possible values, it should read:
@If(OrdStatus = "Confirmed";83;0)
If Confirmed is a variable, make sure it has a value assigned earlier, or the formula compares OrdStatus with "".

Besides adding a compouted for display field + hide when, which you didn't want to use, you could try a controlled access section.
Bozzie4IT ArchitectCommented:
3. Or use a button with popup window to update the field , and hide the button (keep the field computed when composed)

FIELD yourfield :=  @Prompt([OKCANCELEDIT]; "Whatever"; "Type your wnatever in the box below."; "default value");


didier20Author Commented:
The first answer is OK.

The second doesn't work.
I tried with the same formula before ( I mistyped the formula in my question)
If I enter only the icon's number, the icon appears, with the formula no icon can be seen.
OrdStatus is a Combobox with two values:
Confirmed and Not Confirmed

The third....I'm trying right now
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Bozzie4IT ArchitectCommented:
Be careful with this kind of formula, it is case sensitive !  So if you use "confirmed" instead, you won't get a result !



didier20Author Commented:
I still trying the second question but it's very hard, although it should be so simple.
I tried with other fields to see if it works, e.g.
@If(Remark = "A";83;0) but it is always the last number that will be displayed no matter what number or what field name is entered.
I'm very disappointed to work 90 minutes with an icon displaying and still no result.
I think I will leave my database without icons.

Now the third thing.
All the fields on my form should be seen by everyone and anytime but there is two fields which shouldn't be edited by the people. There is only one person who has the right to edit it.
I could hide the field with a user role but the users must see e.g. the remark field why the order was rejected.
I could "hide when opened for editing", but what when the person who's right to edit it, can't see it? He should.
FOr question 2 -- if there is a problem with your formula DISABLE the "display column as icon" setting, so you can see what the formula is actually calculating to.  Once you have debigged teh formula, and it displays 83 when appropriate, then you can turn the icon setting back on.  I would guess one of the following:

* a typo in the fixed string (including case sensitivity or spaces)
* a typo in the field name
* a problem with the field value itself, which might result in @Error

It might also be useful to have an adjacent column, for debugging purposes, that shows the field alone
For your last question, there are two ways to handle it.

1) If most people can be Author access, and this one user can be Editor access, then you can set the field so that it can only be updated by editors.  That's an option in field properties, on the security tab.

2) You can assign a role to the person, called [FieldAuthority] (for example).  Then, put the  field in a controlled access section with a computed for display value of "[FieldAuthority]" -- note that local replicas are an issue for controlled access sections.
For Q2:
Qwaletee's got a good point switching off the "display as icon" for a while. You should see the change as soon as you changed the fields value in the document. Worst case after pressing F9 (refresh).
Are you sure that your making changes in the exact same form/document/view/database (server + path + extention) as the one your consulting for a result? You could also drop the formula for a moment and replace it with just a number (pref. entirely different). If that doesn't work, something else is wrong (like wrong db) and it's no use fiddling around with the formula!
BlackmoorianDirector of Professional ServicesCommented:
For question #2: For some reasons I have always had a hit or miss using = in an @if statement within Notes. Most of the time it works other times it does not. To get around this I usually use an @Contains instead.

For this instance I would change the formula to be @If(@Contains(OrdStatus;"Not";0;83) and remember case sensitivity.
BlackmoorianDirector of Professional ServicesCommented:
Sorry just noticed the typo in my response correct syntax would be:

didier20Author Commented:
Question 2.
I did what qwaletee suggested. I saw the numbers.
I pasted Blackmoorian's formula.
The same effect:
It's always the number at the end of the formula which counts, I mean I can change everything in the formula, nothing happens except the last number. If I change the last number from 83 to 82 the icon changes as well.
Bozzie4IT ArchitectCommented:
In the Designer, it's 'normal' you don't see the icons immediately : always check in the Notes client first.  If you close and reopen the view (and database) in Designer, you should see the icons in designer too.
didier20Author Commented:
I create a Confirm button which give to field the right value. And this button gives to ViewIcon the number 83. It works.

I give a field the security option "Must have at least Editor access to use" Then I logged in with another ID which has only Author Access and..... and the Author was able to edit the field to which a person should have editor rights.

didier20Author Commented:
How to create a field which everyone can see but only one can edit?
I created a user role [FieldAuthority], give the person this right. Field property computed for display., but what does it mean
"put the  field in a controlled access section "

How to create a field which can be seen by all users but only a manager can write to it ?
BlackmoorianDirector of Professional ServicesCommented:
For Q3 - Actually in this case I would create two fields one that is display only and the other that is editable. For those that have the right role hide the other field and vice versa.


Field1 is editable and is hidden if user is not a member of FieldAuthority role.
Field2 is computed for display and contains the value of Field1 and is hidden if user is a member of FieldAuthority role.

At any given time only one field will be visible - one that is editable and the other that is not.
> ...but what does it mean "put the  field in a controlled access section "

Start off with your existing field. Select the entire line (it'll turn black) and choose: Create > Section > Controlled access.
You'll now see a line "Untitled Section", preceded by a (collapsed) twistie. Click on the twistie and the section will expand, reveiling your field.
Put your cursor on the line with the twistie and open its property box.
Tab 1: set the title text that should be shown. You can also set some of the sections colour options.
Tab 2: you could define here how the section should be shown (expanded/collapsed) to either editors or non-editors of the section.
Tab 3: define the sections editor(s) in a formula.
   Type : Computed for display (editable would be the worst!)
   Access formula: "[FieldAuthority]"
      (i.e. incl. quotes and square brackets)
Tab 4: Font settings
Tab 5: Hide settings

Note that it can be somewhat confusing where the section ends if you continue to edit in it. Best is to mark the last few lines in the section and the ones below it eg. "1", "2", "3" etc. and collapse/expand it. That'll reveil the 1st line outside the section.

If you choose to use 2 fields, put the 2nd one on the 1st line below the editable field. Make the new one computed for display and name is similar (e.g. if the original field is called "myField" you could add a suffix like "_dsp" -> "myField_dsp"). Its formula should refer to the original fields name: myField (without quotes).
The 1st one should be shown only in the document is in edit mode AND if the user has the userrole:
   @UserRoles*="[FieldAuthority]" & @IsDocBeingEdited
The computed for display field should be shown in all other cases. Easiest is:
   !(@UserRoles*="[FieldAuthority]" & @IsDocBeingEdited)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
didier20Author Commented:
When getting the first answers I was disappointed but after that I got very useful solutions that work fine.
I've only 100 points to split but first I want to thank you all for the answers.
Not clear -- did you solve both problems?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.