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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 set filter at import
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jussl007

Germany
3 Posts

Posted - 10/17/2013 :  07:41:31 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

greg

USA
1378 Posts

Posted - 10/17/2013 :  2:33:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

jussl007

Germany
3 Posts

Posted - 10/18/2013 :  02:20:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you!
Its working perfectly!
Go to Top of Page

jussl007

Germany
3 Posts

Posted - 10/18/2013 :  06:07:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.


Go to Top of Page

greg

USA
1378 Posts

Posted - 10/22/2013 :  10:44:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;
}
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000