I have a data table that plots the below. I need to find the corresponding x values for the points that are nearest to y=0. I need the first two points (red lines) that cross (nearest) zero, the third crossing is not of interest.
I can find the closest value using the script:
value = 0;
d = Abs((:"col" << get values) - value);
rows = Loc(d == Min(d));
Show(rows);
Data Table( "DT" ) << select rows(rows);
This returns the value that is closest to the zero line regardless of when it crosses.

These two x-values will go into the dt as a new column and used for further calculations. Am I on the right track with the above script?
BTW, I'm new to JMP scripting (and to programming in general).
Thanks!