Using @Sum to calculate form field totals

Hi all,

I have a form that has a number of user input fields.
At the bottom of the form I have a field which finds the total of these fields using @Sum

My question is, how can I have the user input fields be blank when a new document is created?
i.e. I don't want to have to put 0 as the default value for all these fields.

At the moment I am nearly there using this:

res:=@Sum(@TextToNumber(@Trim(@Text(basic_hours + basic_hours_1 + basic_hours_2 + basic_hours_3 + basic_hours_4 + basic_hours_5 +basic_hours_6))));
@If(@IsError(res)=1;"";res)

However, this obviously only displays the total when all fields have a value.
Is there any way around this problem?

Thanks
LVL 21
shuboarderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

p_parthaCommented:
Wonderful tip from sjef:

a:= 4;
b:= 10;
c:= "";
d:= 6;
@Sum(@TextToNumber(@Trim(@Text(a):@Text(b):@Text(c):@Text(d))))

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shuboarderAuthor Commented:
That Sjef is a clever chap ;)
0
p_parthaCommented:
Yeah my bro is ....
0
Sjef BosmanGroupware ConsultantCommented:
^ | ^
  __
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.