Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

sum calculations

Avatar

06-08-2008

I am having difficulty doing a simple calculation. I would like to total a column. I am not sure how to make the function. I press sum and I get

Sum(n1 [, n2...]). Give me an example how I should write this.



I am working on a time sheet and would like to total hours for each day of the week. So I have a column with days of the week and a column with hours and would like to get total. Please help.

Replies

Avatar

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 7
gkaiseril
Level 7

Likes

13 likes

Total Posts

456 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Applaud 5
View profile
gkaiseril
Level 7

06-08-2008

"Sum" is the function name. the "(" and ")" mark the start and end of the passed parameters to the function. the "n1 [,n2...]" indicate that there is one required parameter and then any number of optional parameters. The description in the 'Scripting Reference" under LiveCycle Designer's "Help" is:



"Returns the sum of the non-null elements of a given set of numbers."



So one could enter numbers, the values form field names, or an array of a field name as parameters and get the sum of the values.



If I have a row of fields called "DailyHours" and have 7 of these fields I could code for the "Calculation" script for the row total using FormCalc:



Sum(DailyHours[0], DailyHours[1], DailyHours[2], DailyHours[3], DailyHours[4], DailyHours[5], DailyHours[6])



or



Sum(DailyHours[*])