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.
|