Extract worksheet data using a condition
1. wxt test:="mod(col(c),2)==1" ow:=<new>; 2. wxt test:="col(1)<5" sel:=1;
Please refer to the page for additional option switches when accessing the x-function from script
Input
string
Worksheet
int
Option list:
Output
See the syntax here.
vector
//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"; newbook; impasc options.sparklines:=0; // Select all rows in worksheet with make=Acura and Gas Mileage > 11 // Use range variable to make query more readable than "col(Make)[i]$" range car=col(Make); // Using string variable to avoid having to write "Acura" inside " " string str="Acura"; //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 newbook result:=bkname$; //Import a file path$ = system.path.program$ + "Samples\Statistics\"; fname$ = path$ + "body.dat"; impasc; //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);