You can use the Remove()
method of Associative Arrays to do this without any JSL loops:
Names Default to Here( 1 );
reference table = New Table( "TEST",
<<New Column( "A" ),
<<New Column( "B" ),
// <<New Column( "C" ),
<<New Column( "D" ),
// <<New Column( "E" ),
<<New Column( "F" ),
// <<New Column( "G" ),
<<New Column( "H" ),
<<New Column( "I" ),
<<New Column( "J" ),
<<New Column( "K" ),
<<New Column( "L" ),
<<New Column( "M" ),
<<New Column( "N" ),
<<New Column( "O" )
);
cols of interest = {"B","C","D","E","F"};
table cols = reference table << Get Column Names( "String" );
table cols aa = Associative Array( table cols );
cols of interest aa = Associative Array( cols of interest );
cols of interest aa << Remove( table cols aa );
cols missing = cols of interest aa << Get Keys;
If( N Items( cols missing ),
New Window( "Error",
<<Modal,
Text Box( "Some columns are missing!" ),
Text Box( Concat Items( cols missing, ", " ) )
);
Throw()
);
Print( "rest of script..." )
Jordan