Multiple arguments with the filter command

Mark Powell mark_powell at symantec.com
Wed Oct 25 17:16:32 EDT 2006


Aah, my ambiguity.  What I am looking for is an OR solution.  For
example, 

Keep file names with "Europe" OR ".ps" OR "53" 

That is why I have a vNewContainer variable, although file names
satisfying more than one string would have to dealt with.

Mark


-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Marielle
Lange
Sent: Wednesday, October 25, 2006 2:32 PM
To: How to use Revolution
Subject: Re: Multiple arguments with the filter command

Yep, this was the fast solution to the "and" problem ;-). Best strategy
to adopt then is to first sort the search items by length.  
Then run your repeat loop from longest to shortest. If lucky, you will
only have 1 or 2 items left in your file list. What matters then is the
size of your list of words to search for rather than the size of the
original list of files.

I was not quite sure to understand the use of your vNewContainer
variable. Filter will directly act on your variable such that only the
lines that the filter let go appear in the new list. So, in fact, you
could code it this way and as with the strategy outlined above, if lucky
after the first repeat, vNewContainer wlll be very small.

put vContainer into vNewContainer
repeat for each item thisItem in vInputStrings
   filter vNewContainer with ("*!*" & thisItem & "*!*") end repeat ...do
something with vNewContainer


> Thanks to both Jim and Marielle for their awesome feedback.   
> Instead of
> asking specific questions about the details of your feedback, I want 
> to ask a general performance question.  The filter does work within a 
> repeat loop like this:
>
> repeat for each item thisItem in vInputStrings
>   get vContainer
>   filter it with ("*!*" & thisItem & "*!*")
>   put cr & it after vNewContainer
> end repeat
> ...do something with vNewContainer
>
> But given that vInputStrings could be very large, my concern is that 
> the getting and putting involved would be dangerously memory- or 
> processor-intensive.  What are the risks you have seen with the brute 
> force approach like the one above?
>
> Mark
>
>
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Mark 
> Powell
> Sent: Wednesday, October 25, 2006 10:04 AM
> To: use-revolution at lists.runrev.com
> Subject: Multiple arguments with the filter command
>
> Another text filtering question, please.  I have studied the archives 
> but have not found precisely the solution that works.
>
> I have a container vContainer of file names, each line of the form
>
>   <directory>/!?!<filename>!/<filesize>/<creationdate>
>
> Here are three literal examples:
>
>   C:/The World/Asia/!?!prologue.ps!/1026/1115309596
>   C:/The World/Europe/!?!Map of Europe.jpg!/3536844/1155845730
>   C:/The World/!?!About1953.txt!/4288/1161776573
>
> User-input text strings can define what files from vContainer are to 
> be retained. The following works to filter-in the first example above:
>
>   filter vContainer with ("*!*.ps*!*")
>
> However, if the user wants both ".ps" and "Europe" to be retained, how

> best to do it without repeat loops and a lot of temporary copies of 
> vContainer?  Is there a way?
>
> One catch is that if the user inputs something like "53", the 
> operation must recognize the fact that the "53" in the first two 
> examples is not a part of the file name, thereby filtering them out, 
> but that "53" is a part of the file name in the third example, thereby

> filtering it in.
> This is one reason for the exclamation point tokens in vContainer.
>
> Any ideas greatly appreciated.
>
> Mark Powell
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

------------------------------------------------
Marielle Lange (PhD),  http://widged.com Bite-size Applications for
Education





_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list