Hello Dojo,
I'm trying to set a parameter to N/A and noticed something strange happening,
Here is the parameter:
<Param id="1000" trending="true">
<Name>tunerFrequency</Name>
<Description>Frequency</Description>
<Information>
<Subtext>
<![CDATA[Tuner Frequency]]>
</Subtext>
</Information>
<Type>read</Type>
<Interprete>
<RawType>numeric text</RawType>
<Type>double</Type>
<LengthType>next param</LengthType>
<Sequence noset="true">div:1000</Sequence>
<DefaultValue>-1000</DefaultValue>
<Exceptions>
<Exception id="1" value="-1">
<Display state="disabled">N/A</Display>
<Value>-1</Value>
</Exception>
</Exceptions>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Range>
<Low>87.1</Low>
<High>107.9</High>
</Range>
<Decimals>2</Decimals>
<Units>MHz</Units>
<Positions>
<Position>
<Page>General</Page>
<Column>0</Column>
<Row>0</Row>
</Position>
</Positions>
</Display>
<Measurement>
<Type>number</Type>
</Measurement>
</Param>
As you can see, I'm trying to set this parameter to -1 in order for it to display "N/A" by default. However, I've discovered that the parameter value is actually -0.001. It appears that the value 1000 was divided twice by 1000, resulting in -0.001 instead of -1. Could it be that there is an issue with the combination of Sequence and DefaultValue tag, or is this the intended behavior?
Hi Emir,
based on information provided here, Sequence tag should only be used for polled parameters. I've tested it, and it does seems that default value gets sequence applied to it twice(for other operations as well). If you were to change value of DefaultValue tag to -1000000, would that work in your case?
Note that it might not be the best idea to rely on this, it might be undefined behavior. Ideally you would avoid doing this. Since your range is from 87.1-107.9, maybe you could set both exception value and default value to 0, in that case it would be irrelevant how many times sequence gets applied to it.
Hope this helps,
Cheers
Hello Edib,
-1000000 will work, but I believe there is an issue with negative values when the DefaultValue and Sequence tag are both used on a parameter, I would prefer if I didn’t do workarounds.
This parameter is also filled in by polling from SNMP, I created a blank protocol with only this parameter, and removed the SNMP tag to check if I would encounter the same problem.