DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve a string Conversion Problem?

Hello,
 
i try to get the rownumber of the maxium by ChnFindReverse("Ch(""v_ber"")="&Str(ChnValMax("v_ber"))) .
Sometimes the Funtion returns zero, is that a rounding or conversion problem? Is there another way to get the position of the max value?
 
Thanks
 
diademi
0 Kudos
Message 1 of 6
(4,165 Views)
Hello diademi,

Yes, the PNO function, it determines the row in a numeric channel or a text channel, of which the contents are closest to a specified value or text.

Greetings
Walter
0 Kudos
Message 2 of 6
(4,146 Views)
Thanks Walter,
 
is ther any chance get the last positon and not the first?
 
Thanks
Diademi
0 Kudos
Message 3 of 6
(4,144 Views)
Hi diademi,

the pon function looks for the best match. If the absolute max. value is stored more than one times the pno function find the first best match. But in general should the ChnFindRevers work correct. This function return 0 if the condition is false that means no match was found. In that case it could be that the equal sign (=) causes this. In most every case it is better to use <= or >=.

Greetings

Walter
0 Kudos
Message 4 of 6
(4,134 Views)

Hi Walter,

i tried it already with => it works also only sometimes. I guess the conversion to a string or the MaxValue returns a rounded value, or?
I worked around this by substracting 1 permille of the returned maximum, so i get a position that is nearby. 
For my Problem <= wouldn´t work, because <= would always return the last value in the channel.

Thanks

diademi

 

0 Kudos
Message 5 of 6
(4,130 Views)

Hi diademi,

Try using the "ValEqual" function in the Find expression.  I'm actually not sure when that became available, but I'm guessing it was with 10.1.

Row = ChnFindReverse("ValEqual(Ch(""Revs""), CMax(""Revs""))")
MsgBox Row & vbCRLF & ChD(Row, "Revs")

If this doesn't work, please send us a sample data set,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 6
(4,121 Views)