selecting multiple rows defined by col var<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Hi all,
I've found this script from one of the on-demand webcast data dt1 << Select Where( :Term == "Intercept" ); and adapting it to my data table the result is:
..... << Select Where( :SOURCE == "Facebook");
- but how will I choose more than one (Facebook and Zoover and Tripadvisor...)
- how will I clear the selection and make another selection
- how will I invert the selection
Many thanks

Re: selecting multiple rows defined by col varExactly so! Use the "&" command to combine selection criteria.
dt << select where(Contains(..., :X) & Contains(..., :Y));
Re: selecting multiple rows defined by col varTo adress multiple items of a list using an index [...] an matrix should be used.
my_list[1]; //First item
my_list[[1, 3]]; //First and third items
my_list[[1 2 3]]; //First to third items
my_list[1::3]; // Same thing
The double colon is short for Index(), i.e. it creates a matrix with a range of integers.
1::2 equals the matrix [1 2]
Re: selecting multiple rows defined by col varI've understood the second command, it chooses the 1st and 2nd of my selection list and the third and fourth goes as [1 :: 2 :: 3 :: 4]?, many thanks
Re: selecting multiple rows defined by col varThank you MS, I fell short to understand the second command, does it choose the 1st and 2nd values by order? No.. Does it select 1st and and 3rd by adding up 2?
What would be the command If I happen to have a second column (:Y) (with the second selection named as my_selection2) and would like to select the both together my_selection & my_selection2 ?
Many thanks for your support.
Re: selecting multiple rows defined by col varThe example code below may give some ideas (the Wait(1) commands are only for demo purpose);
dt = New Table("demo", New Column("X", character, values({"a", "b", "c", "d", "q", "a", "b", "c", "d"})));
my_list = {"a", "c", "q"};
Wait(1);
dt << select where(Contains(my_list, :X));// Select all items in my_list
Wait(1);
dt << select where(Contains(my_list[1 :: 2], :X));//By default need to clear before making another selection
Wait(1);
dt << invert row selection; // Invert selection
Wait(1);
dt << clear select;// Clear selection