Hi Ian Ian@JMP,
An extension to what I was previously working on:
Using the same data as the previous question, based on the selected words that I want from the available columns in data table "Air Traffic", I am expecting an output as shown below if the available columns in the data contains the words in the "SelectedNames" column at their respective rows:
However I am getting this error message in Log & no insertion of any correct column names in the second column:
These are my codes, can you help me to check what's wrong with them?
dt = Open( "$SAMPLE_DATA/Air Traffic.jmp" );
a = {"Number", "Flight"};
col = dt << get column names( string );
nc = N Items( col );
dt1 = New Table( "Table1" );
c1 = (dt1 << New Column( "SelectedNames", character, set values( a ) )) << get values;
dt1 << New Column( "AvailableColumns", character );
xxx={};
For( j = 1, j <= N Items( c1 ), j++,
For( i = 1, i <= nc, i++,
If( Contains( col[i], a[j] ),
Insert Into( xxx, col[i] )
);
Column( dt1, 2 )[j] = Eval( xxx );
xxx = {};
);