You are viewing limited content. For full access, please sign in.

Question

Question

How to use SUM function with a table?

asked on January 19, 2016

I have a table that has an hours column. I want to add all of the hours columns values and display them in a Total Hours single line field outside of the table. I tried using "=SUM(table13.Hours)" but it doesn't work as expected. What is the correct syntax for that type of calculation?

1 0

Replies

replied on January 19, 2016

Is the "Hours" column configured as a number field? If not, what field type is being used? Also, is table13.Hours the correct name of the column value, i.e. was that the name supplied when you browsed for field from the variable picker?

0 0
replied on January 19, 2016

It is a single line field. table13.Hours is the name supplied when using the variable picker.

0 0
replied on January 19, 2016 Show version history

You'll need to change it from a single line field to a number field. We can look into a future enhancement where numbers can be parsed from single line fields to then use in calculations.

0 0
replied on January 19, 2016

That would be extremely useful as a lot of our production forms utilize single line fields instead of number fields.

0 0
replied on January 19, 2016 Show version history

For now, you can continue using custom JS to handle these types of calculations.

*Edit* In the upcoming Forms 10 SP1 release, it will support a new formula called VALUE which can parse numbers from a text field. You will need to create a new number type column i.e. HoursNum and use a calculation for that field like

=VALUE(table13.Hours, ROW())

and then in the single line field outside the table, use

=SUM(table13.HoursNum)

The reason for this is to maintain compatibility with the open formula standard.

2 0
replied on January 25, 2016 Show version history

Hi Blake,

If there's a way for you to convert the Single Line field to Number field (decimal), will you use that to convert the Single Line fields to Number field (decimal) in your production forms?

0 0
replied on January 29, 2016

Yes Abby. If there was a way to convert a field type to another type I would take advantage of that feature. We used single line fields before because we needed the ability to have decimal values, but would gladly switch them over to number fields now that that feature is in Forms 10.

1 0
replied on January 29, 2016

Ok. We'll look into this.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.