DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ChnFind-Syntax

Hello,
 
I am using the search function "ChnFind" in Diadem version 10.2. My function call looks like this:
 
Dim StartIndex_Hin, MinWinkel
 
MinWinkel= CCh(Channel,1) ' Search the Minimumvalue in the channel
StartWinkelHin = MinWinkel + 10  ' MinValue + 10
 
 
StartIndex_Hin = ChnFind("Ch("&Channel&")>"StartWinkelHin"",0) ' finde the value (StartWinkelHin ) in the Channel
 
Unfortunately it doesnt work. I get the error that ")" is missing . . . .
 
When I use the function call:
 
StartIndex_Hin = ChnFind("Ch(""1/Winkel A"")>10",0)
 
Everything works good!!!
Can you tell me what am I doing wrong?
 
thanks for your help!
 
 
 
 
0 Kudos
Message 1 of 9
(6,170 Views)
Hello FHM!
 
Assuming 'StartWinkelHin' is a VBS variable, DIAdem can not access it in ChnFind! One solution is to convert the value to the string reprsentation like this:
 
StartIndex_Hin = ChnFind("Ch("&Channel&")>" & str(StartWinkelHin),0) ' finde the value (StartWinkelHin ) in the Channel
 
Another approach is to use a DIAdem variable for the compare value like R1.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 9
(6,165 Views)
Thank you for your quick reply. I test both of them but it didnt work. any another idea ?
0 Kudos
Message 3 of 9
(6,158 Views)

Hello FHM!

I will add my complete code. In my test everything works fine!

Option Explicit
 
Dim StartIndex_Hin, MinWinkel
Dim Channel
Dim StartWinkelHin
 
Channel = 2
 
MinWinkel= CCh(Channel,1) ' Search the Minimumvalue in the channel
StartWinkelHin = MinWinkel + 10  ' MinValue + 10
 
StartIndex_Hin = ChnFind("Ch("&Channel&") > " & str(StartWinkelHin),0) ' finde the value (StartWinkelHin ) in the Channel
 
MsgBox StartIndex_Hin

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 9
(6,155 Views)

thanks for your reply. You are right it works fine as long you use "Channel=2" if you use "Channel="Test" " it wont work any more. The error tells that ")" is needed.

that was and is still the problem Smiley Sad

0 Kudos
Message 5 of 9
(6,142 Views)
Hello FHM!
 
If Channel is a string the code has to look like this:
Option Explicit
 
Dim StartIndex_Hin, MinWinkel
Dim Channel
Dim StartWinkelHin
 
Channel = "Test"
 
MinWinkel= CCh(Channel,1) ' Search the Minimumvalue in the channel
StartWinkelHin = MinWinkel + 10  ' MinValue + 10
 
StartIndex_Hin = ChnFind("Ch("""&Channel&""" ) > " & str(StartWinkelHin),0) ' finde the value (StartWinkelHin ) in the Channel
 
MsgBox StartIndex_Hin
Important are the additional double quotes! A good practice is to display the expression in the ChnFind with a Messagebox like this
 
There it is easier to see the syntax faults.
Call MsgBox("Ch("""&Channel&""" ) > " & str(StartWinkelHin))
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
Message 6 of 9
(6,137 Views)
Thank you very much it works now!Smiley Happy
0 Kudos
Message 7 of 9
(6,133 Views)

I would like to resurect this topic for one clarifiation.Is there a way to call out the GROUP using this method? I'm trying to do a very similar thing, except that I'm searching different channels in different groups.

 

 

Thanks in advance.

0 Kudos
Message 8 of 9
(4,984 Views)

Hi FCW,

 

Yes, you can add the Group syntax in several ways instead of your current Ch("ChannelName") syntax:

 

Ch("GroupName/ChannelName")

Ch("GroupName/[ChannelIndex]")

Ch("[GroupIndex]/ChannelName")

Ch("[GroupIndex]/[ChannelIndex]")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 9
(4,976 Views)