07-11-2016 03:20 AM
Hi
I am trying to get the Chnfind function to work and have done following and want to work as shown on 1.:
I think there is something wrong with the syntax.
The Data.Root.ChannelGroups(1).Name return "BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level"
The Data.Root.ChannelGroups(1).Channels(5).Name return "PER at fixed Level"
1.
This code below doesn´t work
intMyResult=ChnFind("Ch(""[" & str(Data.Root.ChannelGroups(1).Name) & "]/[" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & "]"")>0")
Call msgbox ("Test2:"+str(intMyResult))
2.
This code below work
intMyResult = ChnFind("Ch(""BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level/PER at fixed Level"")>0.1",0)
Call msgbox ("Test2:"+str(intMyResult))
07-11-2016 03:38 AM
Good morning,
In the first form you use the syntax for [groupNumber]/[ChannelNumber]
Whilst in the second one you use GroupName/ChannelName
Try the first one without the "[" and "]" symbols.
From it:
intMyResult=ChnFind("Ch(""[" & str(Data.Root.ChannelGroups(1).Name) & "]/[" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & "]"")>0")
to:
intMyResult=ChnFind("Ch(" & str(Data.Root.ChannelGroups(1).Name) & "/" & str(Data.Root.ChannelGroups(1).Channels(5).Name) & ")>0")
Regards,
Arrion
07-11-2016 03:48 AM
Hi
Then I got an error with Expected ')'
07-11-2016 04:18 AM
Hi again,
I tried this script and it works:
dim intMyResult
MsgBox( data.Root.ChannelGroups(1).Name) 'group_1
Msgbox ( str(Data.Root.ChannelGroups(1).Channels(5).Name)) 'spd_x
intMyResult=chnFind("Ch(""group_1/spd_x"")>0.5",0)
MsgBox intMyResult 'returns 406 -> Works
intMyResult=chnFind("Ch(group_1/spd_x)>0.5",0)
MsgBox intMyResult 'returns -1 -> Wrong, the "" are required
intMyResult=chnFind("Ch(" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(5).Name & ")>0.5",0)
MsgBox intMyResult 'returns -1 too. -> Wrong, the "" are required
intMyResult=chnFind("Ch(""" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(5).Name & """)>0.5",0)
MsgBox intMyResult 'returns 406 too. -> Works
It seems necessary to have the multiple " " " symbol otherwise it returned me a wrong result.
07-11-2016 04:46 AM
Hi
Thanks now it works.
After i changed the .Channels(5) to .Channels(2) which is the same channel
intMyResult = ChnFind("Ch(""BLE4_2 RxCI-SelectivityPerf BLE (1 Mbps) NOC 2402MHz PER at fixed Level/PER at fixed Level"")>0.1",0)
Call msgbox ("Test1:"+str(intMyResult))
'Return 5 which is correct
intMyResult1=chnFind("Ch(""" & Data.Root.ChannelGroups(1).Name & "/" & Data.Root.ChannelGroups(1).Channels(2).Name & """)>0.1",0)
Call msgbox ("Test1:"+str(intMyResult))
'Return 5
07-12-2016 10:05 AM
Just in case:
If you are using a new version of DIAdem (2015) then you can take advantage of the new parameters for Chnfind which allow you to use a simpler syntax
The following assumes that you have loaded the exampel data set and want to search for the first value > 35 in channel "Speed"
Set oChn = Data.Root.ChannelGroups(1).Channels("Speed") ' "Speed channel"
IP = ChnFind("A > 35.0",1,Array("A"),Array(oChn))
LogFileWrite("Found at position: "&IP)