Page 1 of 1

filter command limitation?

Posted: Tue Dec 02, 2025 10:35 pm
by dunbarx
The "Filter" command is compact and powerful. But it is limited in the sense that it only works with "whole" lines, items, keys, etc. In other words, I wish that, given in a field 1:
aa,bb,cc
dd,ee,ff
gg,hh,jj
it would filter out line 2 from the following:

Code: Select all

on mouseUp
   get fld 1
   filter lines of it without "ee"
end mouseUp 
But it does not, since it only sees "whole" lines. Am i missing something here? Is there a way to lose line 2 because it contains a string, as opposed to the line being the string?

Craig

Re: filter command limitation?

Posted: Tue Dec 02, 2025 10:41 pm
by SparkOut
Hi Craig,
You can use * as a wildcard before/after the filter part. With some possible fudging for beginning/ends of the line and checking for CR as well.

Re: filter command limitation?

Posted: Wed Dec 10, 2025 3:28 pm
by richmond62
I have a feeling there is a relatively straight forward way to do this.

Currently making Kichiri (marvellous stuff) in the kitchen: will get to the computer in about 30 mins and try out my idea.

Re: filter command limitation?

Posted: Wed Dec 10, 2025 3:54 pm
by richmond62
SS 2025-12-10 at 16.51.05.png
-

Code: Select all

on mouseUp
   put empty into fld "f2"
   put 1 into LYNE
   repeat until line LYNE of fld "f1" is empty
      if line LYNE of fld "f1" contains "ee" then
         -- do nothing
      else
         put line LYNE of fld "f1" & cr after fld "f2"
      end if
      add 1 to LYNE
   end repeat
end mouseUp
-
filterTips.jpg

Re: filter command limitation?

Posted: Wed Dec 10, 2025 4:05 pm
by dunbarx
Sparkout.

Oooh. I will try that, and I realize I have done that sort of thing before. :oops: I think the fact that I am filtering by lines obviates the need to worry about returns or anything else. LC will consider only lines.

Craig

Re: filter command limitation?

Posted: Wed Dec 10, 2025 4:39 pm
by dunbarx
Sparkout.

That did the trick, of course. I cannot see any traps where too much filtering might occur. Your idea is already, as I thought, restricted line by line by LC itself, and it reads to me that any line containing any string would be deleted.

Thank you. :D

Craig