Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Hiding Zero Values

Avatar

Level 2

HI,

I have a form on which I would like to not see the zero values.  For instance, I have one numeric field that sums the total of a column.  If there are no values in that column, a 0 appears in the numeric field.  I would prefer that nothing appear in that numeric field, until a value has been entered.  Can I do that?

Thanks!!

4 Replies

Avatar

Level 10

In the event where you calculate the sum of the total, you need to check if that sum equals to zero then set the rawValue to "";

Use FormCalc as the language..

if(Sum(NumericField1.rawValue) == 0) then
NumericField2.rawValue = "";
endif

Thanks

Srini

Avatar

Level 2

Thanks so much Srini. Unfortunately, I'm still a little lost. I have VERY little exposure to this program (teaching myself as I go). The calculation I currently have in the field is as follows:

hasvalue(Table5.Row1[3].TextField8)+

hasvalue(Table5.Row1[4].TextField9)+

hasvalue(Table5.Row1[5].TextField10)+

count(Table4.Row1[*].TextField26)

How would I incorporate it in to what you have below? Thanks!

Karen Duerr | Human Resources Manager

Lake Nona

9801 Lake Nona Road, Orlando, FL 32827

direct: 407-816-6597          cell: 407-947-7810

main:  407-851-9091          fax:  407-859-0436

www.LearnLakeNona.com

Avatar

Level 10

Karen,

     Try this way..

     I am assuming you are placing the below code in the Calculate event of the Numeric field which you do not want to display ZERO..

var intTotal = hasvalue(Table5.Row1[3].TextField8)+hasvalue(Table5.Row1[4].TextField9)+hasvalue(Table5.Row1[5].TextField10)+count(Table4.Row1[*].TextField26);

if(intTotal >0) then
$.rawValue = intTotal;
else
$.rawValue = "";

endif

Avatar

Level 2

WOW! That worked perfectly. I had a number of places where I wanted to do the same thing and it worked for all of them. Thanks so much!!!!!!!!!!

Karen Duerr | Human Resources Manager

Lake Nona

9801 Lake Nona Road, Orlando, FL 32827

direct: 407-816-6597          cell: 407-947-7810

main:  407-851-9091          fax:  407-859-0436

www.LearnLakeNona.com