I would like to create a single JSL script that will create a V List Box of overlay plots only for those columns that exist in a data file. The names of the columns may change from file to file, or may be absent or present. I can't figure out how to create an Overlay Plot where I list all possible variables to be plotted, but only plot those present in the current data table.
Any suggestions would be greatly appreciated.
For example, plot the following soil temperatures if present in the current data table, but assume that the last column (Tsoil - 10cm #2 (C), or any other column for that matter, is absent.
Clear Log();
sdate = Date MDY( 10, 1, 2010 );
sdate_view = Format( sdate, "m/d/y h:m" );
n_rows = N Rows();
edate = :Name( "Date & Time" )[n_rows] + 500000;
edate_view = Format( edate, "m/d/y h:m" );
dt = Current Data Table();
dt << Clear Row States;
win1 = New Window( "Hourly Plots",
V List Box(
op1 = Overlay Plot(
X( :Name( "Date & Time" ) ),
Y( :Name( "Tsoil - 5cm (C)" ), :Name( "Tsoil - 10 cm (C)" ), :Name( "Tsoil - 10cm #2 (C)" ) )),
Where( :Name( "Date & Time" ) >= sdate & :Name( "Date & Time" ) <= edate ),
Separate Axes( 1 ),
Connect Thru Missing( 1 )
),
Report( op1 )[Frame Box( 1 )] << {Frame Size( 700, 250 ), Marker Size( 1 ), DispatchSeg( Marker Seg( 1 ), {Color( "Red" )} )},
Report( op1 )[Axis Box( 1 )] << Axis Settings( {Format( "Fixed Dec", 10, 1 ), Inc( 0.5 ), Minor Ticks( 0 ), Show Major Grid( 1 )} ),
Report( op1 )[Axis Box( 2 )] << Axis Settings(
{Format( "m/d/y", 10 ), Interval( "Day" ), Inc( 14 ), Minor Ticks( 0 ), Show Major Grid( 1 ), Show Minor Grid( 0 ), Min( sdate ),
Max( edate )}
) << Remove Axis Label << Add Axis Label( "Date & Time" ),
)
);