annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

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
Messaggio 1 di 9
7.616Visualizzazioni
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
Messaggio 2 di 9
7.611Visualizzazioni
Thank you for your quick reply. I test both of them but it didnt work. any another idea ?
0 Kudos
Messaggio 3 di 9
7.604Visualizzazioni

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
Messaggio 4 di 9
7.601Visualizzazioni

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 Triste

0 Kudos
Messaggio 5 di 9
7.588Visualizzazioni
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?  
Messaggio 6 di 9
7.583Visualizzazioni
Thank you very much it works now!Smiley Felice
0 Kudos
Messaggio 7 di 9
7.579Visualizzazioni

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
Messaggio 8 di 9
6.430Visualizzazioni

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
Messaggio 9 di 9
6.422Visualizzazioni