Solved

# How to count with field values?

Posted on 2005-05-02
233 Views
I have four fields: a,b,c,d.
The value of Field "a" should be (b*c-d)
Field "a" is computed when composed.
But it doesn't work, I get an error message:
Field a: Incorrect data type for operator or @Function.
It's strange because when I enter b+c+d, it works fine.
What is to trick to count with field values?
0
Question by:didier20

LVL 46

Expert Comment

Can you give the whole formula, svp? It seems your syntax is wrong somewhere.

By the way, if a field is Computed when Composed, it will be calculated only once: when composed, and never again.
0

LVL 46

Expert Comment

Following conditions are also important:
- all your 4 fields must be of a numeric type
- all fields must have a content
- all contents must be valid numeric values
0

LVL 14

Expert Comment

Since a is computed when composed, it's sure that either b or c or d , doesn't have value and a should be below all this fields.

Partha
0

LVL 13

Expert Comment

Didier20, does this occur on a specific (let's say newly composed) document, or in an agent running on a bunch of documents. I'd like to rule out that (b*c-d) was fired on a different document than b+c+d: if one of these computations fails, I'd expect the other to fail on the very same document as well! If one succeeds, the other one should do so to!
0

Author Comment

Case 1 (just for test) (a = b+c+d)
When I open the database and click "New Request" the Form will be opened and if I set the values e.g. b=10, c=5, d=3 and press Ctrl+S, then the value of a=18 and no error message.

Case 2 (a = b*c*d) (I did nothing else only replaced "+" with "*")
When I open the database and click "New Request" I get immediately the error message:

Field a: Incorrect data type for operator or @Function: Number expected

The fields b,c,d, are below the field a.
The property of the fields b,c,d: number and editable.
Field "a" is number and Computed (I changed it)

Please tell me why the values can be added to each other but not multiplicated.

0

LVL 46

Accepted Solution

C'est bizarre...

I tried it myself, and you're right (of course): why the addition is more forgiving than the multiplication puzzles me. I think that the string-concatenation is taken instead of addition, which leads to an empty string result, which is a valid value for a number field. Since there is no alternative meaning for the multiply-operator, you're bound to get an error.

Solution:
x:= b*c*d;
@If(@IsError(x); ""; x)
0

Author Comment

Thanks,

It works fine.
0

LVL 13

Expert Comment

Good guess. 0 + b + c + d raises the error right away!
0

## Featured Post

### Suggested Solutions

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…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…