From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Find cant compare with point number

Solved!
Go to solution

Hi all,

 

got an Problem with "Find"

 

I wanna create an application that works as moving average.

So I  take the Arith. Mean from 30 Blocks

 

zaeler1         =  zaeler1+1
        zaeler2         =  zaeler2+1
        statsel(6)      = "Yes"
        Call StatBlockCalc( "Block" , zaeler1 & "-" & zaeler2 , "[" & ChannelNr & "]/I_" & pruefling & "\15")
        arithmean  =  StatArithMean

then I add an offset as limit (here upper limit)

sum             =  ioben + arithmean

then I wanna find the measurement that doesnt fit.

 intmyresult    =  Find("Ch(""[" & ChannelNr & "]/I_" & Example & "\15"")>" & (arithmean) & "",morefail )

but the line with fin produce an Error.:

"

FIND("Ch("[1]/I_4812\15")>1,415"",2) fehlende rechte Klammer ")".

"

 

I use Diadem 14.0

 

Has anyone an Idea ?

 

 

Thank you

Michael

0 Kudos
Message 1 of 5
(4,248 Views)

Hi Michael,

 

Debugging Calculate and Find expressions is the worst thing about using them, so I always try to make the expressions look as simple as possible.  One great way to do that is to separate the channel expression from the Calculate or Find expression by assigning it to a T1, T2, T3 variable, like this:

 

T1 =  "[" & ChannelNr & "]/I_" & Example & "\15"
intmyresult =  Find("Ch(T1)>" & arithmean, morefail)

I also removed the parentheses around the arithmean variable-- in VBScript enclosing a variable in parentheses often subtype-casts it to a boolean, which I doubt you want.  Anyway, the "&" string concatenation operator automatically subtype-casts the arithmean variable to a string in order to perform the concatenation, so you don't need the parentheses.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 5
(4,235 Views)
Solution
Accepted by topic author MichGer

Hi Michael,

 

Brad is right that it is hard to debug convoluted formulas, but I would like to give it a try Smiley Happy

 intmyresult    =  Find("Ch(""[" & ChannelNr & "]/I_" & Example & "\15"")>" & (arithmean) & "",morefail )

I suppose you are in DIAdem SCRIPT and not in the calculator? If so I think your conversion of "arithmean" is incorrect (in case you have a German Windows localization):

 

What happens if you write?:

Call Msgbox(arithmean)

For me the output is:

1,415 ' comma!

Is it the same for you too?

 

If so, your string has an additional comma and is incorrectly interpreted by FIND.

Please try to write:

 

Str(arithmean)

instead of

(arithmean)

Hope that helps you along!

 

Best regards,

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 3 of 5
(4,213 Views)

Wow,

 

It works,.

 

Thanks a lot!!!

 

 

0 Kudos
Message 4 of 5
(4,210 Views)

You are welcome! Thanks for the feeback.

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
0 Kudos
Message 5 of 5
(4,206 Views)