07-28-2020 02:43 AM
Hello,
I have a problem on the Maximum-Property for Data-Channels.
So if I create a new Channel and want to get the maximum of the new Channel like this:
Dim Grp: Set Grp = data.Root.ChannelGroups.Add("Group_1")
Dim Channel1: Set Channel1 = Grp.Channels.Add("Channel1",DataTypeChnFloat64)
'Fill Channel
Dim i
for i = 1 to 10
Channel1(i) = i
Next
'Get Maximum
Dim ChnMax
ChnMax = Channel1.Maximum
LogfileWrite "ChnMax: " & ChnMax 'does not work: ChnMax = Null
'However:
LogfileWrite "Channel1(5)= " & Channel1(5)
The result is Null - however, if I want to get a specific value of the Channel (like the 5th value), it works.
What is the problem here? Also in the data-portal the right value for the maximum will show up:
Thanks in advanced for your help!
Solved! Go to Solution.
07-29-2020 02:33 AM
Hello MaT_305,
Which DIAdem version do you use?
With the command "ChnCharacter" you can calculate the chracteristics of a channel.
Dim Grp: Set Grp = data.Root.ChannelGroups.Add("Group_1")
Dim Channel1: Set Channel1 = Grp.Channels.Add("Channel1",DataTypeChnFloat64)
'Fill Channel
Dim i
for i = 1 to 10
Channel1(i) = i
Next
call ChnCharacter(Channel1)
'Get Maximum
Dim ChnMax
ChnMax = Channel1.Maximum
LogfileWrite "ChnMax: " & ChnMax 'does not work: ChnMax = Null
'However:
LogfileWrite "Channel1(5)= " & Channel1(5)
Greetings
Walter
07-29-2020 02:46 AM
Hello Walter,
Thank you for your solution.
I´m using Diadem 2018.
So do I always have to "update" the created channel with the command 'ChnCharacter' in order to get min/max of a Channel?
07-29-2020 05:01 AM
Hello MaT_305,
Ideally, these characteristics would be calculated each time the value changes. We will have a look at this, and as long as it does not work this way, the ChnCharacter() command is a good workaround.
Greetings
Walter