Hi,
I've tried many methods of trying to select specific rows with PM#=2 and Logistic#=1 in my pre-filtered table, but I either get a 'Send expects scriptable object' message, a 'Scriptable[]' and then script termination, or an endless loop. Can someone please help with what is inappropriate with the syntax that I cannot program the row selection? Thanks!
lamstationfile=Pick File("choose file","$Documents" );
dt=Open(lamstationfile,
Import Settings(End Of Field( Tab ),Scan Whole File( 1 ), Column Names Start(7 ),Data Starts( 8),));
dt = Current Data Table();
//find data rows
w=NRow(dt);
dt<<Select Where(:Time=="NUM_DATA_ROWS")<<Label(1);
d=dt<<Get Selected Rows;
Show(d);
dt<<Select Where(Row()>(d-1));
dt2=dt<<Subset( Selected Rows(1), Selected columns only(0));
dt<<Select Where(Row()>(d-1))<<Delete Rows;
// Change first two columns to numeric data
Column(dt,1)<< Data Type (Numeric); Column(dt,1)<<Modeling Type("Continuous");
Column(dt,2)<< Data Type (Numeric); Column(dt,2)<<Modeling Type("Continuous");
nw= New Window( "What PM?",<<Modal,<<Bring Window To Front,
V List Box( Text Box( "PM#"), pm_in = Text Edit Box("PM#", <<Justify Text (Center)), Spacer Box(Size(25,25))),
H List Box( Button Box("OK", pm= pm_in << Get Text();), Button Box("Cancel", nw<<Close Window)));
nw= New Window( "What Logistic?",<<Modal,<<Bring Window To Front,
V List Box( Text Box( "Logistic#"), wafer_in =Text Edit Box("Logistic#"), Spacer Box(Size(25,25))),
H List Box( Button Box("OK", logis= wafer_in << Get Text();), Button Box("Cancel", nw<<Close Window)));
//take out uneccessary PM data
Show("PM"|| pm);
ColNames = dt << Get Column Names();
colstrings = char(colnames);
match = regex(colstrings, "PM"|| pm);
//Show(colstrings);
found_list={};
close(dt2,no save);
//how can I have it with 2 dt open?
for (i = 1, i <= nitems(ColNames), i++,
if (contains(ColNames[i], match),
ColNames[i]<<Set Selected(1)
//insertinto(found_list, ColNames[i]);
);
);
Column(dt,1)<<Set Selected(1);
//For found_list<<Set Selected(1);
//Show(found_list);
dt3=dt<<Subset( Selected Rows(0), Selected columns only(1));
Num(logis);
Show(logis);
//Logistics column is the last in the table
clos=NCol(dt3);
Show(clos);
Show( Column( dt3, clos )[2] );
//dt3<<Get Rows Where(:Column(clos)==logis); //Method #1
dt3<<Selet Where(:Column( dt3, clos ) == Num( logis )); //Method#2
//For(i=1, i=NRows(dt3), i++, //Method#3
//If( Column( dt3, clos )[i] == Num( logis ),
// Column( dt3, clos )[i] << Set Selected( 1 )); );
//For Each Row(If( :Column( dt3, clos ) == Num( logis ), :Column( dt3, clos ) << Set //Selected(1)); //Method#4