02-07-2007 07:05 AM
02-07-2007 09:31 AM
02-07-2007 09:52 AM
Hello Julia,
First of all the command ChnPropvalGet does not seem to be recognised by Diadem. I am using version 10.0
msgbox ChnPropValGet("[1]/EnergyAKJ", "maximum") + ChnPropValGet("[1]/EnergyBKJ", "maximum")
The values which I want to add our Real values.
Also this statement puts the Total into a msgbox, can I put it into a property value.
Thanks
Stagsden.
02-07-2007 10:17 AM
You are correct - it looks like ChnPropValGet only shows up in DIAdem 10.1. I use different versions of DIAdem, so often re-create the new functions that I enjoy and register them as a user command (using ScriptCmdAdd). I think something like the function below should give you somewhat similar results. And yes, you should be able to put this value into a channel property by using the ChnPropSet command, and perhaps the ChnPropCreate command, if you want to create a new property. For example, the bit between the dashed lines saves the sum of the maximum values to the variable, "MaxSumVal" and then creates a property for channel #5 called "MaxSum" and sets this value to MaxSumVal. But you could also put the value in an already-created property, but some excisting channel properties are read-only. I hope this is not confusing!
--------------
MaxSumVal = ChnPropValGet(4, "maximum") + ChnPropValGet(3, "maximum")
Call ChnPropCreate(5, "MaxSum", DataTypeFloat64)
Call ChnPropSet(5, "MaxSum", MaxSumVal)
Call ChnPropSet(5, "Description", MaxSumVal)
--------------
Public Function ChnPropValGet(ChnNum, ChnProperty)
Dim ChanType
ChanType = ChnPropGet(ChnNum, "displaytype")
Select Case ChanType
Case "Numeric" ChnPropValGet = Val(ChnPropGet(ChnNum, ChnProperty))
Case "Text" ChnPropValGet = ChnPropGet(ChnNum, ChnProperty)
Case "Time" ChnPropValGet = ChnPropGet(ChnNum, ChnProperty)
Case Else ChnPropValGet = ""
End Select
End Function ' ChnPropValGet
02-07-2007 10:55 AM