Finit Blog

Ask Our Ace: SCALC in Webforms - How to get the sum of a row that is a list of items

Written by jbulman | Mar 21, 2018 12:27:14 PM

HFM User:

I’m trying to create a web form that has a member list and a subtotal.  In Financial Reporting, I can use a formula such as Sum([2]) which adds the contents of row 2, even if row 2 is a list.  Is this possible in forms?  I’ve tried many variations on SCALC, but the form still does not sum a row that is a list of items.

Chris Barbieri:

I have also encountered this issue, so I posed the question to my team here at Finit.  As is typical of Finit, I think about six people replied to me shortly after I asked for help.  The issue is simply syntax:  in at least one document I read, I thought the syntax was:

Scalc(R(2))

Really, it was:

Scalc(Row(2))

Part of my confusion was that when HFM failed to recognize the R, it returned only the value from the current entity in the POV.  I couldn’t understand why the form was returning this number.  In retrospect, I would expect HFM to return an error upon opening the form, but it does not.  After getting help from my team and then re-reading the latest documentation, I confirmed the “Row” syntax.  Then, everything worked as expected.  Below is the syntax in question:

R1=E#Cur,CustomHeaderStyle:font-weight:Bold

R2=E{Active Descendants of POV(@POV)}

R3=Scalc(Row(2)),CustomHeaderStyle:font-weight:Bold,CustomHeader:Sum LCORP_US

Note that while the R syntax works in most cases, I recommend always using Row because it works in all cases, including the Scalc on a row or column with a list.

Do you have an issue or topic that you’d like Chris to discuss in his next blog post?  Please e-mail us at insights@finit.com and we will “Ask our ACE”!