Re: Newbie: find, search command
--- "D.Rothe" <[EMAIL PROTECTED]> wrote: > at the end of the field I simply used "filter > theField without empty". "That's brilliant!" -- Ken Ray yes it is. > on mouseUp > do FindData(tString, tData) > end mouseUp > > function FindData pStringToFind, pDataToSearch > repeat for each line tLine in pDataToSearch > if pStringToFind is in tLine then put tLine & > cr after tFoundData > end repeat > put tFoundData into fld "List" > filter fld "List" without empty > end FindData a function is generally used to "return" a value: on mouseUp put FindData(tString, tData) into fld "List" end mouseUp function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine & cr after tFoundData end if end repeat filter tFoundData without empty return tFoundData end FindData or use a handler (no parens for params): on mouseUp FindData tString, tData end mouseUp on FindData pStringToFind, pDataToSearch ... filter tFoundData without empty put tFoundData into fld "List" end findData different forms, same result. Erik Hansen = [EMAIL PROTECTED]http://www.erikhansen.org __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
On 12/17/04 4:20 PM, "D.Rothe" <[EMAIL PROTECTED]> wrote: > > Thanx for all the help! The following method was spot on, as for the cr > showing a blank line > at the end of the field I simply used "filter theField without empty". That's brilliant! I didn't even know that "filter theField without empty" would work to remove blank lines in a string...cool! Ken Ray Sons of Thunder Software Web site: http://www.sonsothunder.com/ Email: [EMAIL PROTECTED] ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Newbie find, search command reprise ...
Earlier this week, it was said: > I want to search for ALL instances of Xmas and display the whole > matching line of each found in a list field. > So far I can get it to display the first line only ( Father XmasIs > Drunk) ! > Any help would appreciated!!! I have checked the tutorials for help > but couldn't find what I was looking for, > is there an example stack or notes anyone may know of? > The filter command is the fastest method, but be careful as it is a destructive search i.e. it deletes the liens that don't match, so copy your original data into a variable, filter that and keep the original intact. and a few people said minor variations on this; summary of them being that "filter" was fastest, though not always most convenient. Well, it ain't always so. I ran into some performance issues with my latest app this evening - something that I expected to be almost instantaneous took a long time. I assumed it was just a bug, but eventually convinced myself it wasn't - it was just taking too long. So I looked more closely at the parts where I was using "filter" quite heavily. Input data : 10,000 lines, 1.5 Mb; the lines are all much the same size. Search data: fairly long strings (32 characters each). Success rate: each string happens between 2 and 5 times in the input. In this case, "filter" appeared to be really, horribly slow - so I came up with a simple benchmark to check it. on mouseUp put the millisecs into tStartTime set the itemDel to TAB repeat 4 times put gFiles into tFList filter tFList with "*cb2f8d231f68c5d70b3e62ed0a3c4c8f*" end repeat put "took " & the millisecs - tStartTime && the number of lines in tFList & cr & tFList & cr after msg put the millisecs into tStartTime put empty into fList repeat 4 times repeat for each line L in gFilesput gFiles into tFList if "cb2f8d231f68c5d70b3e62ed0a3c4c8f" is in L then put L & CR after tFList end repeat end repeat put "took " & the millisecs - tStartTime && the number of lines in tFList & cr & tFList & cr after msg The first version took 800 msec, while the second one took less than 1 msec. I thought it must be because of the need to copy the input string to avoid destroying it (though I do need to do that in the real example), so I modified it to put gFiles into tFList1 put gFiles into tFList2 put gFiles into tFList3 put gFiles into tFList4 put the millisecs into tStartTime set the itemDel to TAB filter tFList1 with "*" & "cb2f8d231f68c5d70b3e62ed0a3c4c8f" & "*" filter tFList2 with "*" & "cb2f8d231f68c5d70b3e62ed0a3c4c8f" & "*" filter tFList3 with "*" & "cb2f8d231f68c5d70b3e62ed0a3c4c8f" & "*" filter tFList4 with "*" & "cb2f8d231f68c5d70b3e62ed0a3c4c8f" & "*" put "took " & the millisecs - tStartTime && the number of lines in tFList & cr after msg Note that the time reported excludes the four copies; this still took 760 ms. So at least in some (reasonable) cases, filter is far from being the fastest. I suspect that the offset method Jacqueline suggested would be even faster - but since it was already less than 1 millisec I didn't pursue that thought. -- Alex. ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
Thanx for all the help! The following method was spot on, as for the cr showing a blank line at the end of the field I simply used "filter theField without empty". on mouseUp do FindData(tString, tData) end mouseUp function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine & cr after tFoundData end repeat put tFoundData into fld "List" filter fld "List" without empty end FindData D.Rothe > Message: 1 > Date: Fri, 17 Dec 2004 10:12:17 -0500 > From: "Frank D. Engel, Jr." <[EMAIL PROTECTED]> > Subject: Re: Newbie: find, search command > To: How to use Revolution <[EMAIL PROTECTED]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=US-ASCII; format=flowed > Yes, but a cr at the end will show a blank line at the end of a field. > Remember that list boxes are fields, and the selectable lines are lines > of text from the field. Since you can hit return/enter and add a blank > line at the end of the field and have it displayed, you will also see a > blank line at the end of a list box. > > The original poster specifically stated that he wished to display these > results in a list box (which is a field), so this is definitely an > issue for him. Trust me, it took me a while to work this one out > myself, and I've been using something similar quite heavily (although I > let PostgreSQL do most of my sorts and searches for me -- I just format > the results...) > > On Dec 16, 2004, at 9:43 PM, J. Landman Gay wrote: > > > On 12/16/04 5:42 PM, Frank D. Engel, Jr. wrote: > > > >> Except that you need to delete the last "cr" before putting it into > >> the list, or you will have a blank line at the bottom; just add one > >> line to the code: > >>> function FindData pStringToFind, pDataToSearch > >>> repeat for each line tLine in pDataToSearch > >>> if pStringToFind is in tLine then put tLine &cr after tFoundData > >>> end repeat > >> delete the last char of tFoundData > >>> return tFoundData > >>> end FindData > > > > Sometimes, but it depends on what you're doing. Revolution is > > forgiving enough that a lot of the time it doesn't matter. For > > example, "the number of lines" will return the same number whether the > > carriage return is at the end or not. > > > > This has come up before, and it isn't a bug, it's a feature. Commas > > work the same way. > > > > > >> On Dec 16, 2004, at 6:32 PM, Richard Gaskin wrote: > >>> D.Rothe wrote: > >>> > >>>> Hi, > >>>> I have a tab delimited list I want to be able to search, say I have > >>>> a list of names for example; > >>>> Father XmasIs Drunk > >>>> New YearsIs after Xmas > >>>> RudolphThe Reindeer > >>>> Merry XmasTo all > >>>> I want to search for ALL instances of Xmas and display the whole > >>>> matching line of each found in a list field. > >>>> So far I can get it to display the first line only ( Father Xmas > >>>> Is Drunk) ! Any help would appreciated!!! I have checked the > >>>> tutorials for help but couldn't find what I was looking for, > >>>> is there an example stack or notes anyone may know of? > >>> > >>> > >>> For short lists (<50,000 lines) you may be pleasantly surprised by > >>> the speed of what might look like clunkly Transcript: > >>> > >>> > >>> function FindData pStringToFind, pDataToSearch > >>> repeat for each line tLine in pDataToSearch > >>> if pStringToFind is in tLine then put tLine &cr after tFoundData > >>> end repeat > >>> return tFoundData > >>> end FindData > >>> > >>> > >>> You can call it simply enough: > >>> > >>> on mouseUp > >>> put FindData("Xmas", fld "stuff") > >>> end mouseUp > >>> > >>> > >>> -- > >>> Richard Gaskin > >>> Fourth World Media Corporation ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
RE: Newbie: find, search command
there's many ways actually... you can use the LineOffset(string,container,startingline) function but if you dont care what line it was, check out filter alist with "*xmas" which is much faster and just returns those lines... You could also repeat for each line, each item but that's not very efficient after a few 100 lines... cheers Xavier > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of D.Rothe > Sent: Tuesday, November 16, 2004 23:58 > To: [EMAIL PROTECTED] > Subject: Newbie: find, search command > > Hi, > I have a tab delimited list I want to be able to search, say > I have a list of names for example; > > Father XmasIs Drunk > New YearsIs after Xmas > RudolphThe Reindeer > Merry XmasTo all > > I want to search for ALL instances of Xmas and display the > whole matching line of each found in a list field. > So far I can get it to display the first line only ( Father > XmasIs Drunk) ! > Any help would appreciated!!! I have checked the tutorials > for help but couldn't find what I was looking for, is there > an example stack or notes anyone may know of? > > Thanks D.Rothe > > > > ___ > use-revolution mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/use-revolution > ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
Yes, but a cr at the end will show a blank line at the end of a field. Remember that list boxes are fields, and the selectable lines are lines of text from the field. Since you can hit return/enter and add a blank line at the end of the field and have it displayed, you will also see a blank line at the end of a list box. The original poster specifically stated that he wished to display these results in a list box (which is a field), so this is definitely an issue for him. Trust me, it took me a while to work this one out myself, and I've been using something similar quite heavily (although I let PostgreSQL do most of my sorts and searches for me -- I just format the results...) On Dec 16, 2004, at 9:43 PM, J. Landman Gay wrote: On 12/16/04 5:42 PM, Frank D. Engel, Jr. wrote: Except that you need to delete the last "cr" before putting it into the list, or you will have a blank line at the bottom; just add one line to the code: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat delete the last char of tFoundData return tFoundData end FindData Sometimes, but it depends on what you're doing. Revolution is forgiving enough that a lot of the time it doesn't matter. For example, "the number of lines" will return the same number whether the carriage return is at the end or not. This has come up before, and it isn't a bug, it's a feature. Commas work the same way. On Dec 16, 2004, at 6:32 PM, Richard Gaskin wrote: D.Rothe wrote: Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father Xmas Is Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? For short lists (<50,000 lines) you may be pleasantly surprised by the speed of what might look like clunkly Transcript: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat return tFoundData end FindData You can call it simply enough: on mouseUp put FindData("Xmas", fld "stuff") end mouseUp -- Richard Gaskin Fourth World Media Corporation __ Rev tools and more: http://www.fourthworld.com/rev ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution --- Frank D. Engel, Jr. <[EMAIL PROTECTED]> $ ln -s /usr/share/kjvbible /usr/manual $ true | cat /usr/manual | grep "John 3:16" John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. $ ___ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution --- Frank D. Engel, Jr. <[EMAIL PROTECTED]> $ ln -s /usr/share/kjvbible /usr/manual $ true | cat /usr/manual | grep "John 3:16" John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. $ ___ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
On 12/16/04 5:42 PM, Frank D. Engel, Jr. wrote: Except that you need to delete the last "cr" before putting it into the list, or you will have a blank line at the bottom; just add one line to the code: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat delete the last char of tFoundData return tFoundData end FindData Sometimes, but it depends on what you're doing. Revolution is forgiving enough that a lot of the time it doesn't matter. For example, "the number of lines" will return the same number whether the carriage return is at the end or not. This has come up before, and it isn't a bug, it's a feature. Commas work the same way. On Dec 16, 2004, at 6:32 PM, Richard Gaskin wrote: D.Rothe wrote: Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father Xmas Is Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? For short lists (<50,000 lines) you may be pleasantly surprised by the speed of what might look like clunkly Transcript: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat return tFoundData end FindData You can call it simply enough: on mouseUp put FindData("Xmas", fld "stuff") end mouseUp -- Richard Gaskin Fourth World Media Corporation __ Rev tools and more: http://www.fourthworld.com/rev ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution --- Frank D. Engel, Jr. <[EMAIL PROTECTED]> $ ln -s /usr/share/kjvbible /usr/manual $ true | cat /usr/manual | grep "John 3:16" John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. $ ___ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Newbie: find, search command
Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father XmasIs Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? Thanks D.Rothe ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
Except that you need to delete the last "cr" before putting it into the list, or you will have a blank line at the bottom; just add one line to the code: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat delete the last char of tFoundData return tFoundData end FindData On Dec 16, 2004, at 6:32 PM, Richard Gaskin wrote: D.Rothe wrote: Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father Xmas Is Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? For short lists (<50,000 lines) you may be pleasantly surprised by the speed of what might look like clunkly Transcript: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat return tFoundData end FindData You can call it simply enough: on mouseUp put FindData("Xmas", fld "stuff") end mouseUp -- Richard Gaskin Fourth World Media Corporation __ Rev tools and more: http://www.fourthworld.com/rev ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution --- Frank D. Engel, Jr. <[EMAIL PROTECTED]> $ ln -s /usr/share/kjvbible /usr/manual $ true | cat /usr/manual | grep "John 3:16" John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. $ ___ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
On 11/16/04 4:58 PM, D.Rothe wrote: Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father XmasIs Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? Here's one way: on mouseUp answer getLines("Xmas",fld 1) end mouseUp function getLines tString,tData put 0 into tOffset repeat get lineoffset(tString,tData,tOffset) if it = 0 then exit repeat put line it+tOffset of tData & cr after tNewList add it to tOffset end repeat return tNewList end getLines -- Jacqueline Landman Gay | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
D.Rothe wrote: Hi, I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father XmasIs Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? For short lists (<50,000 lines) you may be pleasantly surprised by the speed of what might look like clunkly Transcript: function FindData pStringToFind, pDataToSearch repeat for each line tLine in pDataToSearch if pStringToFind is in tLine then put tLine &cr after tFoundData end repeat return tFoundData end FindData You can call it simply enough: on mouseUp put FindData("Xmas", fld "stuff") end mouseUp -- Richard Gaskin Fourth World Media Corporation __ Rev tools and more: http://www.fourthworld.com/rev ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Newbie: find, search command
I have a tab delimited list I want to be able to search, say I have a list of names for example; Father XmasIs Drunk New YearsIs after Xmas RudolphThe Reindeer Merry XmasTo all I want to search for ALL instances of Xmas and display the whole matching line of each found in a list field. So far I can get it to display the first line only ( Father XmasIs Drunk) ! Any help would appreciated!!! I have checked the tutorials for help but couldn't find what I was looking for, is there an example stack or notes anyone may know of? The filter command is the fastest method, but be careful as it is a destructive search i.e. it deletes the liens that don't match, so copy your original data into a variable, filter that and keep the original intact. e.g. put field "Data" into tList filter tList with "*Xmas*" put tList into fld "Finds" Using the * before & after the search word allow the lines to have characters before and after the word. If you filtered with "Xmas*", you would only get lines that started with Xmas. Cheers, Sarah ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution