How to multiple select values from one column and subset them?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />I have a table which include a column named 'PCO',
In this column,there are lots of different values,such as 'PCO1','PCO2',...............'PCON',
I want to select the rows include 'PCO1' or 'PCO2' or 'PCO3' and subset them,
but the situation is that I want to use a string that
strPCO=="PCO1","PCO2","PCO3", to select values
so I write a script like:
data_table = open (DATA_PATH)
PCO_CONDITION = {"PCO1","PCO2","PCO3"};
for (i=1,i<=n items(PCO_CONDITION),i++,
data_table<)
);
dt=data_table<
this script cant work,can anybody tell me how to deal with it?
Thanks guys
Re: How to multiple select values from one column and subset them?Thank you
Re: How to multiple select values from one column and subset them?You have to parse them out of the text edit box using words and a carriage return + line feed delimiter:
nw = New Window( "Example",
Panel Box( "PCO",
Lineup Box( N Col( 1 ), Spacing( 3 ),
pco_teb = Text Edit Box( "",
<<set width( 240 ),
<<set N lines( 5 )
),
)
),
button box("OK",
pco_text = pco_teb << get text;
// Create a delimiter consisting of a carriage return + line feed
crlf = hex to char("0D0A");
// Parse the list into separate words
pco_list = words(pco_text, crlf);
nW << close window;
);
);
Re: How to multiple select values from one column and subset them?Thanks,I have another trouble here,I have a txtbox like this :

now my script is :
Panel Box ("PCO",
lineup box (N col( 1 ),Spacing ( 3 ),
//PCOcheck = check box({"Type in PCO"},PCO << enable (PCOcheck << Get ())),
PCO = text edit box("", << enable ( 1 ),
<
),<< set width (240),<
But how can I get a string like ("PCO1","PCO2","PCO3") from input?
Re: How to multiple select values from one column and subset them?Use Or(), or here even better, Contains() to match any of the three conditions instead of one at a time.
Example:
//Example table
data_table = newtable("test", newcolumn("PCO", character,
values(Repeat(i=0;{i++ ; "PCO" || Char( Mod( i-1 , 5 )+1 )}, 25 )))
);
// Make conditional subset
PCO_CONDITION = {"PCO1","PCO2","PCO3"};
data_table<<select where(Contains(PCO_CONDITION,:PCO));
dt=data_table<<subset (selected rows);
Re: How to multiple select values from one column and subset them?In addition,I want make all rows include these 3 PCOs into a subset,but now my script can only select the last one.