The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 if condition for data extraction

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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
}

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000