DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

NOVALUE when using ChnPropValGet, ChnPropGet and property.value

I try to get the maximum value of a channel. In the scrip, I used ChnPropValGet, ChnPropGet and draging the property of "Maximum" under the channel and to display the value. However it showed "NoValue" for most the cases while sometime it did give the right value. It was in a For loop. This must be a very easy point i overlooked and makes me so frustrated. Can anyone explain what might be the happening here?

 

 

here is my code:

 Dim torque,torque_max
torque = ChnPropValGet(Ch("[1]/[2]"), "name")

'torque_max = ChnPropGet(torque, "maximum")
'torque_max = ChnPropValGet("[1]/[2]", "maximum")

torque_max = Data.Root.ChannelGroups(1).Channels("Torque").Properties("maximum").Value
call msgbox(torque)
call msgbox(torque_max)

 

 

Finally, I used the cch and it worked. 

0 Kudos
Message 1 of 2
(3,343 Views)

Even if you can see the maximum value in the property list it might be uncalculated if you access it via script.

(It is calculated on the fly if property window is showed because of the channel preview window)

To make shure it is calculated call the command that calculates it.

Call ChnCharacter("[1]/Time")
Call ChnCharacterAll()

You can either do it if the value is novalue or if you can spare the time just calculate it on the start of your script. Be aware that till DIAdem 2015 the characteristic values where automatically calculated on load (even if noone used them).

This behavior can be reenabled by switching

DIAdem Settings->Panels->Navigator->Loading Behavior->Do not calculated characteristic values

 

Message 2 of 2
(3,318 Views)