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="">(d-1));
dt2=dt<<SUBSET>(d-1))<<DELETE rows=""></DELETE></SUBSET></SELECT>
I thought that @uday_guntupalli code should work, however in 13.2.1 it would not(strange). However, using As Column() instead of Column() allowed your specific code to work
Names Default To Here( 1 );
dt3 = Open( "$SAMPLE_DATA/Big Class.jmp" );
logis = "55";
clos = "Height";
dt3 << Select Where( As Column( dt3, clos ) == Num( logis ) );
dt3 <Re: Scriptable[] or 'send expects scriptable object'Sorry, I should have been more clear. The problem I am having is with the end of my code after I've created a third data table dt3. Everything before the last active line of code works fine [getting rows and columns in first data table dt, setting the inputs PM#=2 and Logistic#=1 are fine ]. I just cannot select several rows in dt3 where Logistic# =1 .
I've tried several different methods as noted in the code excerpt below, but I either get code terminated with 'Scriptable[]' note or 'Send expects scriptable object' error. I'm not sure where in the below code is preventing it from running appropriately.
<SPAN class="token comment">//dt3<<GET rows="" where="">
dt3<SPAN class="token operator"><</SPAN><SPAN class="token operator"><</SPAN>Selet Where<SPAN class="token punctuation">(</SPAN><SPAN class="token punctuation">:</SPAN><SPAN class="token function">Column</SPAN><SPAN class="token punctuation">(</SPAN> dt3<SPAN class="token punctuation">,</SPAN> clos <SPAN class="token punctuation">)</SPAN> <SPAN class="token operator">==</SPAN> <SPAN class="token function">Num</SPAN><SPAN class="token punctuation">(</SPAN> logis <SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">)</SPAN><SPAN class="token punctuation">;</SPAN> <SPAN class="token comment">//Method#2</SPAN>
<SPAN class="token comment">//For(i=1, i=NRows(dt3), i++, //Method#3</SPAN>
<SPAN class="token comment">//If( Column( dt3, clos )[i] == Num( logis ),</SPAN>
<SPAN class="token comment">// Column( dt3, clos )[i] << Set Selected( 1 )); );</SPAN>
<SPAN class="token comment">//For Each Row(If( :Column( dt3, clos ) == Num( logis ), :Column( dt3, clos ) << Set //Selected(1)); //Method#4</SPAN></GET></SPAN>
Re: Scriptable[] or 'send expects scriptable object'Here is a script that covers the first issue in your data table, selecting row after finding "NUM_DATA_ROWS:
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 = N Row( dt );
dt << Select Where( :Time == "NUM_DATA_ROWS" ) << Label( 1 );
d = dt << Get Selected Rows;
Show( d );
// A matrix is returned from << Get Selected Rows, so you need to reference d[1]
dt << Select Where( Row() > (d[1] - 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, 1 ) << format("hr:m:s");
Column( dt, 2 ) << Data Type( Numeric );
Column( dt, 2 ) << Modeling Type( "Continuous" );
Concerning your selection of columns and then subsetting, I would suggest that you use the builtin column selection tool, "Columns Viewer" rather than building your own selection tool.
dt << Columns Viewer;
Re: Scriptable[] or 'send expects scriptable object'Sorry. The data is now appropriately attached.
Re: Scriptable[] or 'send expects scriptable object'@asdf :
Attachment (.zip) file is empty - so your data was not provided to test your code and see you error to troubleshoot .
In the absence of the actual data you are working with - here lets look at this example .
dt = Open( "$SAMPLE_DATA/Air Traffic.jmp" );
dt << Select Where(:Airline == "Delta" & :Event == "Arrive");
As you can see - you can select rows where two different conditions on two different columns are being met.
In your case - if the PM#=2 and Logistic#=1 refer to 2 different tables - then you need to join the tables based on common columns for what you are after.
If its not either - please provide actual sample data .