T O P I C R E V I E W |
maric001 |
Posted - 10/06/2014 : 04:22:32 AM Origin Ver. and Service Release (Select Help-->About Origin): 9.1 SR3 Operating System: Win7
Hi there!
I have written a simple script to extract my data according to two ID values:
win -o Samples { for (ii=0; ii<=9; ii++) { wxt test:="Col(C6)=$(ii)" iw:=[Samples]Samples! ow:=[Samples]productID$(ii); for (kk=0; kk<=5; kk++) { wxt test:="Col(C7)=$(kk)" iw:=[Samples]productID$(ii)! ow:=[productID$(ii)]measureID$(kk); }; }; };
Script works, but the values for "productID"(Col C6) and "measureID" (Col C7) can be different in different datasets, but always have a maximum range from 0-9 and 0-5, respectively. My script will produce a lot of workbooks/worksheets with no content at all, if or example only productID 0 and 2 are there, since it creates a worksheet for ProductIDs 0-9 all the time.
How can i implement an if condition, that only extracts the data if the product ID is existent in the data? Same for the downstream process of extracting measureID?
Thanks for your help guys! |
1 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 10/06/2014 : 09:06:36 AM You can use the vfind X-Function to test if a value exists in a dataset:
dataset dsIndex; vfind ix:=col(C6) value:=$(ii) ox:=dsIndex; if(dsIndex.GetSize() > 0) { // code to run when you find a value } else { // code to run when value not found }
|
|
|