Hello

I am using <float>1</float> for my channel result data , How can I limit the default decimal places to 2 from the current 18 ? I don't want to edit every sensor channel manually , Is there any other way ?

Regards


Article Comments

You use the <DecimalMode> switch for that:

<Float>1</Float>
<DecimalMode>2</DecimalMode>

:)


Nov, 2014 - Permalink

Hi,

Yes , I tried to use DecimalMode 2 , However I am still getting 18 decimal places in web ui. Following are my setting in script -

<result>
  <channel>Traffic_in</channel>
  <Unit>SpeedNet</Unit>
  <SpeedSize>MegaBit</SpeedSize>
  <mode>Difference</mode>
  <float>1</float>
  <DecimalMode>2</DecimalMode>
  <value>$traffic_in</value>
</result>

Nov, 2014 - Permalink

Ah okay. You can also use the round function in PowerShell: <value>([System.Math]::Round($traffic_in, 2))</value> Then it will have two decimal places by default. Just looked at the API and the DecimalMode only accepts Auto and All, no integers. My bad!


Nov, 2014 - Permalink

Oh I See , But my $traffic_in is integer value (counter64) , I think speedsize=MegaBit is converting the value to decimals , Is there any other way to limit decimals in my case ?


Nov, 2014 - Permalink

You could leave the speedsize out and it will use the default unit for speeds that is configured for the device: (([System.Math]::Round($traffic_in, 2))/1024/1024)


Nov, 2014 - Permalink