I want to use common javascript code - Browser and the Client for arithmetic calculations.
In the browser, the calculations are producting numeric field values. Using the same calculation in the notes 6.5 client, the calculation is producing a correct result, but it is storing that value as text.
The calculation is performed in an called routine in a Javascript library. Here’s the code. The third argument is the form field:
Subject: Javascript in Notes Client does not produce Numeric
I’m no Javascript guru, but this doesn’t surprise me: JS is not a strongly typed scripting language (you don’t “declare” your variables to be any kind of data type), so writing a string to a Notes field doesn’t sound unusual – Javascript has no concept of Notes fields and their data types – whereas writing to an html field (which is similarly “untyped”) would result in the expected outcome.
If the field’s computed numeric anyway, is there no way you can “force” the result to be numeric with some extra @formula in the field itself? i.e. using @IsNumber and wot-not?
Otherwise, I’m sure someone far better than I can come up with something to help!
Subject: RE: Javascript in Notes Client does not produce Numeric
Thanks for your input. What you said about JS in the client makes sense. I took your advice and added the following formual to the value field on the form. (I also took the opportunity to do some rounding. Here’s what I used as the value formula in the field called ‘inkCostPer’: