cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
bobmorrane
Level V

Row selection issue

Hello,

 

So I'm trying to do something fairly simple, but I get a weird behaviour wit hthe row selection. 

 

So I got a table with some mixture design data. I've got 12 columns for 12 different mixture components. There are three columns which for each line tell which three components are present, named comp A, comp B, comp C. 

The runs have been split into series named with a letter from A to K. I want to make a script to run a bunch of fit models all at once. To do so, I need to make subtables with the right rows. Basically selecting each series one by one using the :Series column. My issue is that there are also lines with a single component. I made the following script.

 

 

Names Default To Here( 1 );		
Delete Symbols(); 				

mytable = Current Data Table();
Serieslist = {} ; 

For Each Row(
If( 
	:Series !="X" & !Contains item (:Series, Serieslist),
	Serieslist = Insert (Serieslist, :Series)
	);

);

mytable << clear selected row states ();

Letter = Serieslist [1];	


mytable << Row Selection( Select where (:Series == Letter) );
S1 = :Comp A[mytable<<get selected rows ()];	
S2 = :Comp B[mytable<<get selected rows ()];
S3 = :Comp C[mytable<<get selected rows ()];

Complist = {};
// since I have several rows selected, the output is a list, so I can just choose any element from this list. So S1[1] works
Complist = Insert(complist, S1[1]) ;
Complist = Insert(complist, S2[1]) ;
Complist = Insert(complist, S3[1]) ;

print ("complist = ");
print (complist );

Now when I try to make a selection with the right lines, it doesn't work the way it should. Using a bunch of Print() instructions, I made sure that my values were correct. 

 

 

Now check the following piece of code : 

 

 

mytable << Row Selection( Select where (:Ref == complist[1]) );
wait (2);
mytable << Row Selection( Select where (:Ref == complist[2]) );
wait (2);
mytable << Row Selection( Select where (:Ref == complist[3]) );
wait (2);



mytable << Row Selection( Select where (:Ref == complist[1]) );
wait (2);
mytable << Row Selection( Select where (:Ref == complist[2]), current selection ("extend") );
wait (2);
mytable << Row Selection( Select where (:Ref == complist[3]), current selection ("extend") );




mytable << Row Selection( Select where (:Ref == complist[1]) );
wait (2);
mytable << Row Selection( Select where (:Ref == "comp 6"), current selection ("extend") );
wait (2);
mytable << Row Selection( Select where (:Ref == "comp 12"), current selection ("extend") );

 

 

 

The first three instructions do select the right rows. But when I try to select multiple rows, using the  current selection ("extend") argument, it doesnt' work. Am I missing something? 

 

On the last line, when I manually write a value in the select where () argument, it does work, but when the code has to make an evaluation for '==', it stops working. Anyone got a solution? I'm pretty sure there's a better way to do this, but still, I'd like to understand why it doesn't work. IS it something with Eval Parse? 

 

I've attached the data table with the script. 

 

 

 

 

 

 

 

 

 

 

~~Bob~~
1 REPLY 1
jthi
Super User

Re: Row selection issue

It seems that with Row Selection you would have to evaluate the values when using Current Selection Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute . You could try changing to << Select Where instead

mytable << Select where(:Ref == complist[1]);
Wait(2);
mytable << Select where(:Ref == "comp 6", current selection("extend"));
Wait(2);
mytable << Select where(:Ref == "comp 12", current selection("extend"));
-Jarmo