javascript - Scientific Notation returned using getItemValueDouble -
i have ssjs function below lines of code keeps returning value of field 'day' in scientific notation. have tried using bigdecimal in addition below no difference. other questions on , other blogs scientific notation decimal have examples java have taken best attempt @ how examples should interpreted ssjs.
value stored in document accessed exportdoc in code below using field name
field name: day
data type: number
data length: 8 bytes
seq num: 1
dup item id: 0
field flags: summary
-37.5
exportdoc.getitemvaluedouble('day'); returned value: -3.75e1 var dform:java.text.decimalformat = new java.text.decimalformat("0.##"); var hrs:string = dform.format(exportdoc.getitemvaluedouble('day')); //using hrs:double returns same value returned value: -3.75e1 var hrs:string = dform.parse(@text(exportdoc.getitemvaluedouble('day'))); //using hrs:double returns same value returned value: -3.75e1 var hrs = number(exportdoc.getitemvaluedouble('day')); returned value: -3.75e1
if multiply exportdoc.getitemvaluedouble('day') 10 -375, if divide 10 still -3.75e1, , if use exportdoc.getitemvalueinteger('day') -38.
this doesn't occur whole negative numbers -2, -108, etc. or positive numbers if not whole number.
any appreciated causing issues when importing our hris system.
are sure haven't set kind of converter?
i pulled test page it's not happening here:
<xp:panel id="upperpanel"> <xp:label value="number field (shows value stored in number field): " id="label1"></xp:label> <xp:inputtext id="inputtext1" value="#{document1.subnum}"> <xp:this.converter> <xp:convertnumber type="number"></xp:convertnumber> </xp:this.converter> </xp:inputtext> </xp:panel> <xp:panel id="lowerpanel"> <xp:label id="label2" value="calculated number (computes value using .getitemvaluedouble()): "> </xp:label> <xp:text escape="true" id="computedfield1"> <xp:this.value><![cdata[#{javascript:currentdocument.getitemvaluedouble("subnum")}]]> </xp:this.value> <xp:this.converter> <xp:convertnumber type="number"></xp:convertnumber> </xp:this.converter> </xp:text> </xp:panel>
looks then:
i tried setting notes form's field property "scientific", (of course) doesn't have influence on xpages.
probably i'm not getting you're trying do?
Comments
Post a Comment