Highlighted
Visitor.
658 views

HPSM arithmetic - calculate value (addition) of several fields

Jump to solution

Experts,

I have several custom fields in probsummary - field1, field2, field3, field4, etc.

In those fields there will be manually added numbers - ex: field1=7, field2=5 etc.

Each time a new value is added in any of those fields, there should be an arithmetic operation: addition on another field, lets call it: overal.result

I tried this through FC/Calculations but obivously i can't hit that syntax right... I've added "true" to all required actions, like add/update/display/initial and in the calculation field i'm trying something like overal.result in $file=field1 in $file+field2 in $file, etc. but obviously this is not the right approcah.

Can someone assist, please ?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution
Try:

Overall.result in $file= val(field1 in $file) + val(field2 in $file)

View solution in original post

5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution

how are those fields defined in the database?  Character, number?

0 Likes
Highlighted
Visitor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution

They will be custom fields so they could be set in both ways. Btw i'm interested in the two approaches if you know: and for character and number?

Many thanks. 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution
If they aren't number, then that is probably why the calculations aren't working. You can't do addition to strings. You probably need to convert the values to numbers before you do the calculation
0 Likes
Highlighted
Visitor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution

I just verified that the test fields are with number type. But i'm sitll not sure what is the right syntax in the calculation. Could you please suggest one ?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM arithmetic - calculate value (addition) of several fields

Jump to solution
Try:

Overall.result in $file= val(field1 in $file) + val(field2 in $file)

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.