Solved

Unexpected results when adding 2 field values with script

Posted on 2003-12-04
4
214 Views
Last Modified: 2013-12-18
Hi Guys


This is just weird

What the following is doing is putting two values together e.g. 3 +3 =33 not 6 as expected
This just started happening, this was in an existing working script

doc.totalAH_1 = doc.CarriedOverAH_1(0) + doc.AllowanceAH_1(0) 'Calculate the used vacation  days
                                    doc.totalAH_2 = doc.CarriedOverAH_2(0) + doc.AllowanceAH_2(0)  'Calculate the remaining vacation days
0
Comment
Question by:adspmo
  • 2
4 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9876495
That says that the two fields are of text and being concatenated

doc.totalAH_1 = @TextToNumber(doc.CarriedOverAH_1(0)) + @TextToNumber(doc.AllowanceAH_1(0)) 'Calculate the used vacation  days
doc.totalAH_2 = @TextToNumber(doc.CarriedOverAH_2(0)) + @TextToNumber(doc.AllowanceAH_2(0))  'Calculate the remaining vacation days

~Hemanth
0
 

Author Comment

by:adspmo
ID: 9876502
This in script not formula
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 300 total points
ID: 9876561
oh I totally missed to see doc.

doc.totalAH_1 = cint(doc.CarriedOverAH_1(0)) + cint(doc.AllowanceAH_1(0)) 'Calculate the used vacation  days
doc.totalAH_2 = cint(doc.CarriedOverAH_2(0)) + cint(doc.AllowanceAH_2(0))  'Calculate the remaining vacation days
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9880940
easy points?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now