/    Sign up×
Community /Pin to ProfileBookmark

adding currency field values

i do have 3 custom fields on my form, which all are currency fields
i am trying to add 2 of them and put teh result on last one.
but they adding liek string and giving some error.

please give me code on this…….

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51May 03.2008 — You are adding two strings together. The browser does not know what you are trying to do, you need to tell it you want to add numbers.

You need to use parseFloat() or Number() to change the strings to numbers.

Eric
Copy linkTweet thisAlerts:
@RaviscriptauthorMay 03.2008 — Thabnks for reply :

Actually i tried with bothe of them, but no luck.

i tried with parseFloat() also.

anthing else i have to dod here . please let me know

function TotalCost(type)

{

var Number(a) = nlapiGetFieldValue('custrecord_travelcost');

var Number(b) = nlapiGetFieldValue('custrecord_flightcost');

var Number(c) = a + b;

nlapiSetFieldValue('custrecord_totalcost',c);

}
×

Success!

Help @Raviscript spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...