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

Question

Question

How to sum a column in a table AND format it to look like part of the table

asked on May 6, 2020 Show version history

I've got the following table and I'm looking to have the "Total Monthly Income" reflect the sum of all the rows in the Amount column. Any idea how to make that happen?

All fields are currently part of the same table but I have no issue pulling out the last row of the table as separate HTML, number, and single line fields if needed. 

0 0

Answer

SELECTED ANSWER
replied on May 7, 2020

It took a bit of CSS, and I'm new to creating forms so I'm sure there's a "neater" way to write the code, but it works. There's a slight spacing difference between the last two rows as well, but I was happy with it. Here's what my end result was:

The top 5 rows of that are a table, where the 6th row is actually an HTML field, a currency field, and a single line field.

I'm going to assume you know how to get fields onto the same line, which is how I did that very first step. From there, I had to hide the label on the currency and single line fields using this CSS:

.hide-label label {display: none;}

You'll also need to add the "hide-label" CSS Class to both the currency and single line fields.

I also made the currency field read-only and formatted each of those 3 fields (HTML, currency, & single line) down to the pixel to get them to align with my table's fields using the following CSS:

#q883 {width: 263px}
#q882 {width: 195px}
#q882 .cf-xlarge {width: 145px}
#q884 {width: 465px}
#q884 .cf-field {width: 455px}

q883 being the HTML field, q882 being the currency field, and q884 being the single line/comment field. 

Lastly, to get the auto summing to occur, I used the formula Jared was kind enough to provide in the formula field of the currency field. My resulting formula was "=SUM(Current_Monthly_Income.Amount)".

 

Hopefully this helps! If I can clarify anything, please let me know! Best of luck Connie :)

3 0

Replies

replied on May 6, 2020

Yes, I would pull the total monthly income field out of the table so the sum is outside of the table. Then you can simply go into the Total Monthly Income field and use a formula =SUM(Amount_Variable). You can use the variable picker to grab that amount variable from the table. 

1 0
replied on May 6, 2020

Thanks Jared! Is the fact that I have those set as currency fields, not number fields, going to be an issue?

0 0
replied on May 6, 2020

No, still will work just fine. 

0 0
replied on May 6, 2020

I got it working, thanks! That was way simpler than I thought. Now for the fun task of formatting it to look like it's part of the table :)

1 0
replied on May 7, 2020

Dylan, if you are able to get the total field to look like part of the table, please post how you did it here.  I would love to see how to do that!

0 0
SELECTED ANSWER
replied on May 7, 2020

It took a bit of CSS, and I'm new to creating forms so I'm sure there's a "neater" way to write the code, but it works. There's a slight spacing difference between the last two rows as well, but I was happy with it. Here's what my end result was:

The top 5 rows of that are a table, where the 6th row is actually an HTML field, a currency field, and a single line field.

I'm going to assume you know how to get fields onto the same line, which is how I did that very first step. From there, I had to hide the label on the currency and single line fields using this CSS:

.hide-label label {display: none;}

You'll also need to add the "hide-label" CSS Class to both the currency and single line fields.

I also made the currency field read-only and formatted each of those 3 fields (HTML, currency, & single line) down to the pixel to get them to align with my table's fields using the following CSS:

#q883 {width: 263px}
#q882 {width: 195px}
#q882 .cf-xlarge {width: 145px}
#q884 {width: 465px}
#q884 .cf-field {width: 455px}

q883 being the HTML field, q882 being the currency field, and q884 being the single line/comment field. 

Lastly, to get the auto summing to occur, I used the formula Jared was kind enough to provide in the formula field of the currency field. My resulting formula was "=SUM(Current_Monthly_Income.Amount)".

 

Hopefully this helps! If I can clarify anything, please let me know! Best of luck Connie :)

3 0
replied on May 7, 2020

Thanks!  I'll have to give that a try!

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

Sign in to reply to this post.