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
 set filter at import

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
jussl007 Posted - 10/17/2013 : 07:41:31 AM
Hello there,

I´m new to the community.
I wanted to know if there´s a script to filter data in a specific column right at the import?
I want to filter for x=1,65 in column D.

Please help me

regards

jussl
4   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 10/22/2013 : 10:44:46 AM
You must disable any Filter in order for this to work. When you conditionally delete rows, it's easier to manage if you start from the end:

range ra = 1; // or whatever column you want to test
for(ii = ra.GetSize() ; ii >= 1 ; ii--)
{
if( 1.65 != ra[ii] ) wdelrows start:=ii end:=ii -ss;
}

The -ss makes the X-Function act silently ( does not output informational messages ).

I find the XF to be ridiculously slow, so I would use the old mark command as long as I am running 8.6 or later:

range ra = 1; // or whatever column you want to test
for(ii = ra.GetSize() ; ii >= 1 ; ii--)
{
if( 1.65 != ra[ii] ) mark -d ra -b ii -e ii;
}
jussl007 Posted - 10/18/2013 : 06:07:16 AM
And how can I now delete the rows, where no 1,65 is?
I have six columns and between each 1,65 are 28 rows which have to be deleted (in each column).
The problem is:
there are nearly 3000 rows. Withe the script:

range aa=1[3:31];
range ab=1[33:61];
... etc.

del aa;
del ab;
..etc.

am I getting nowhere.

The first row has to be deleted and after that everything but the rows where 1,65 is in have to be deleted and that for each column.


jussl007 Posted - 10/18/2013 : 02:20:53 AM
Thank you!
It´s working perfectly!
greg Posted - 10/17/2013 : 2:33:21 PM
You could put the following script into the Worksheet Script to run after import or as a script in an ASCII Import Wizard filter:

wks.col4.FILTER = 1; // Turn on filter for column 4
wks.col4.FILTER$ = "x=1.65"; // Set the test expression
wks.runfilter(); // execute all filters of active sheet

for columns where it's hard to know the number:

wks.col$(colnum(D)).FILTER = 1;
etc.

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