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,167 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,162 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,155 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,152 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,139 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,134 Views)