Extract worksheet data using a condition
1. wxt test:="mod(col(c),2)==1" ow:=<new>;
2. wxt test:="col(1)<5" sel:=1;
See the syntax here.
//There are special considerations when the condition involves text strings. The following example shows a more complicated condition to select based on both a text column and a numeric column.
//import a sample file that has make of cars and their various characteristics
fname$=system.path.program$ + "Samples\Statistics\automobile.dat";
// Select all rows in worksheet with make=Acura and Gas Mileage > 11
// Use range variable to make query more readable than "col(Make)[i]$"
// Using string variable to avoid having to write "Acura" inside " "
//wxt will translate "=" to "==", "and" to "&&"
wxt "car=str$ and col(Gas Mileage)>11" sel:=1; // Select the rows
wcellcolor c:=color(green); // Color those rows
wcellsel; // Clear the selection
This example uses the wxt X-Function to extract records for females at the age of 14.
1. Import the sample data into a book in Origin;
2. Extract the found rows to a new sheet, output the row
indexes and count the total number of these rows.
//Create a new workbook
//Import a file
path$ = system.path.program$ + "Samples\Statistics\";
fname$ = path$ + "body.dat";
//Define two ranges for age column and gender column
range a=col(age), g=col(gender);
//Worksheet data extraction
wxt test:="g=="F" & a==14" ow:=<new> pass:=<new> num:=PassCount;
type -b Number of found rows is $(PassCount);