Hi,
I have 3 fields in a form.
In 2 of those fields I put in a number.
In my 3 field I want to total sum of the 2 fields above.
Field1 + Field2 = TotalField
How?
/Richard
Hi,
I have 3 fields in a form.
In 2 of those fields I put in a number.
In my 3 field I want to total sum of the 2 fields above.
Field1 + Field2 = TotalField
How?
/Richard
Subject: Total of fields
This is a joke right?
You’ve answered your question yourself.
Create two editable numeric fields, FIELD1, FIELD2
create a computed numeric field (called total) with the value:
@Sum(Field1:Field2)
Put the form in test mode:
Put your values in Field1 & Field2, then hit F9 to refresh. The result will appear in the total field.
Lookup up @sum in the designer Help!!
HTH,
Ranjan
Subject: RE: Total of fields
Some days we’re more patient than others. The @Sum function is rarely necessary – only in a few scenarios, such as in the middle of a complex @If or certain long sections of code.
Subject: Total of fields
The formula in field 3 should simply be:
Field1 + Field2
OTOH, if you want to compute it with buttons, events, etc., the formula should simply be the name of the field. A button might use @formula language code like:
FIELD Field3 := Field1 + Field2;
Subject: RE: Total of fields
You can use either! I like the FIELD:= method, but couldn’t be bothered to explain it - @Sum works just as well as doing the totalling by hand - and there are no specific rules to its use…! There is less typing with the total by hand method, and if you need to add another field to it, simply add it to the list!
You can put it in buttons, actions, or whatever u like…
There is no overhead in its use - so what the hell - use it!
Bla, bla, bla
Lots of love, and I’m bored of this now,
R ![]()
Subject: Don’t Forget…
Notes is quirky in handling numerics and does NOT handle arithmetic errors nicely. If you attempt to, say, add a numeric value to a non-numeric value, Notes will place an ugly error message in the results field. Here’s one way of trapping the error so that it doesn’t gunk up your form:
val1 := @If(@IsNumber(field1); field1;0);
val2 := @If(@IsNumber(field2);field2;0);
val1+val2
The above code will add the results of field1 and field2. If either field is not a number, it will be evaluated as zero. If both are zero or not numeric, it will return a zero as well.