[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

How to count with field values?

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
didier20
Asked:
didier20
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
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
 
Sjef BosmanGroupware ConsultantCommented:
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
 
p_parthaCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CRAKCommented:
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
 
didier20Author Commented:
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
 
Sjef BosmanGroupware ConsultantCommented:
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
 
didier20Author Commented:
Thanks,

It works fine.
0
 
CRAKCommented:
> I think that the string-concatenation is taken instead of addition.....

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now