[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Simple questions about the formula language

Posted on 2004-11-21
18
Medium Priority
?
471 Views
Last Modified: 2013-12-18
1.
Value ""
What does it mean, and when should I use it ?
2.
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.
3.
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 ?
0
Comment
Question by:didier20
  • 6
  • 3
  • 3
  • +2
18 Comments
 
LVL 13

Expert Comment

by:CRAK
ID: 12642209
1:
This is an empty string. It's used widely.
E.g. to supress errors in @DbLookup:
   Lst:=@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 := ""

2:
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 "".

3:
Besides adding a compouted for display field + hide when, which you didn't want to use, you could try a controlled access section.
0
 
LVL 15

Assisted Solution

by:Bozzie4
Bozzie4 earned 80 total points
ID: 12642674
...
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");
""

cheers,

Tom
0
 

Author Comment

by:didier20
ID: 12643497
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
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Expert Comment

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

@If(@lowercase(OrdStatus)="confirmed";83;0)

cheers,

Tom
0
 

Author Comment

by:didier20
ID: 12644862
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.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12646591
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
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 120 total points
ID: 12646625
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.
0
 
LVL 13

Expert Comment

by:CRAK
ID: 12648033
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!
0
 
LVL 4

Expert Comment

by:Blackmoorian
ID: 12648543
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.
0
 
LVL 4

Expert Comment

by:Blackmoorian
ID: 12650082
Sorry just noticed the typo in my response correct syntax would be:

 @If(@Contains(OrdStatus;"Not");0;83)
0
 

Author Comment

by:didier20
ID: 12654373
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.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12654450
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.
0
 

Author Comment

by:didier20
ID: 12654663
I create a Confirm button which give to field the right value. And this button gives to ViewIcon the number 83. It works.

Q3.
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.



0
 

Author Comment

by:didier20
ID: 12654902
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 ?
0
 
LVL 4

Assisted Solution

by:Blackmoorian
Blackmoorian earned 80 total points
ID: 12657890
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.

Example:

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.
0
 
LVL 13

Accepted Solution

by:
CRAK earned 120 total points
ID: 12660003
> ...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)
0
 

Author Comment

by:didier20
ID: 12663255
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.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12693238
Not clear -- did you solve both problems?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question