Re: Search question
merge([[artist]][[policeman]]) = A brush with the law Sorry I had to. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
Marty, I don't know if it's the fastest way, but here's one way to do it. Pass with function your tab-delimited list and what you are looking to find in fields 1,3 and 4 and it will return a list of the lines numbers that match. Hope it helps... function getTheMatches tList,findThis set the itemDel to tab put into foundList put 0 into i repeat for each line tLine in tList add 1 to i if item 1 of tLine = findThis then if item 3 of tLine = findThis then if item 4 of tLine = findThis then put i cr after foundList end if end if end if end repeat delete last line of foundList return foundList end getTheMatches Let's say I have a tab delimited list with 4 items and I want to find a match to my search string, except I don't care what item 2 is - it could be a number, a word or be empty, but I want to find the occurrences where items 1, 3 4 match. What's the fastest way to do that? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
How about this: --8- repeat for each line myLine in myList if matchText(myLine, \ ([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)$, \ myVar1, myVar2, myVar3, myVar4) then if myVar1=foo and myVar3=bar and myVar4=baz then -- take some action here end if end if end repeat --8- I'm typing this from memory, and I'm not sure about that repeat statement. I always seem to need to look it up. This assumes, of course, that the fields cannot have tab characters in them. -Ken On 30/01/2012 17:35, Marty Knapp wrote: Let's say I have a tab delimited list with 4 items and I want to find a match to my search string, except I don't care what item 2 is - it could be a number, a word or be empty, but I want to find the occurrences where items 1, 3 4 match. What's the fastest way to do that? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
Or with filter I setup a stack with a list field and 4 search fields, 1 search field for each column, and added a search button. --Search button code on mouseUp put field mylist into tMyList repeat with i = 1 to 4 if field (field i) is empty then put * into line i of tMerge else put field (field i) into line i of tMerge end if end repeat filter tmyList with (merge([[line 1 of tMerge]][[tab]][[line 2 of tMerge]][[tab]][[line 3 of tMerge]][[tab]][[line 4 of tMerge]])) put tMyList end mouseUp Puts an asterisk for empty search fields puts the value for the fields that should be matched against. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
oops. Change the merge line to this for partial matches filter tmyList with (merge(*[[line 1 of tMerge]]*[[tab]]*[[line 2 of tMerge]]*[[tab]]*[[line 3 of tMerge]]*[[tab]]*[[line 4 of tMerge]]*)) On Mon, Jan 30, 2012 at 10:57 AM, Mike Bonner bonnm...@gmail.com wrote: Or with filter I setup a stack with a list field and 4 search fields, 1 search field for each column, and added a search button. --Search button code on mouseUp put field mylist into tMyList repeat with i = 1 to 4 if field (field i) is empty then put * into line i of tMerge else put field (field i) into line i of tMerge end if end repeat filter tmyList with (merge([[line 1 of tMerge]][[tab]][[line 2 of tMerge]][[tab]][[line 3 of tMerge]][[tab]][[line 4 of tMerge]])) put tMyList end mouseUp Puts an asterisk for empty search fields puts the value for the fields that should be matched against. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
Thanks to those who responded to this. I was doing something similar to Dan's idea, but wondered if there was a way to use lineOffset or something else. I'll take a look at all the suggestions and continue on. I wish I could wrap my brain around regex - it all looks like a cat walked across my keyboard to my poor mind! Marty K oops. Change the merge line to this for partial matches filter tmyList with (merge(*[[line 1 of tMerge]]*[[tab]]*[[line 2 of tMerge]]*[[tab]]*[[line 3 of tMerge]]*[[tab]]*[[line 4 of tMerge]]*)) On Mon, Jan 30, 2012 at 10:57 AM, Mike Bonnerbonnm...@gmail.com wrote: Or with filter I setup a stack with a list field and 4 search fields, 1 search field for each column, and added a search button. --Search button code on mouseUp put field mylist into tMyList repeat with i = 1 to 4 if field (field i) is empty then put * into line i of tMerge else put field (field i) into line i of tMerge end if end repeat filter tmyList with (merge([[line 1 of tMerge]][[tab]][[line 2 of tMerge]][[tab]][[line 3 of tMerge]][[tab]][[line 4 of tMerge]])) put tMyList end mouseUp Puts an asterisk for empty search fields puts the value for the fields that should be matched against. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
On 31/01/2012 01:02, Marty Knapp wrote: Thanks to those who responded to this. I was doing something similar to Dan's idea, but wondered if there was a way to use lineOffset or something else. I'll take a look at all the suggestions and continue on. I wish I could wrap my brain around regex - it all looks like a cat walked across my keyboard to my poor mind! [...] filter tmyList with (merge(*[[line 1 of tMerge]]*[[tab]]*[[line 2 of tMerge]]*[[tab]]*[[line 3 of tMerge]]*[[tab]]*[[line 4 of tMerge]]*)) That's funny...I was thinking the same thing when I saw the filter stuff above. *grin* -Ken ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
On 31/01/2012 01:20, Bob Sneidar wrote: The last time I got into regex, I forgot how to pee. Took two days to get it back. Remind me not to be in the same room when you tackle Objective-C...:^) -Ken ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Search question
Huh. I knew I liked merge but didn't know why until now. put merge([[kitty1]][[kitty2]]) into tCatfight On Mon, Jan 30, 2012 at 11:46 PM, Ken Corey k...@kencorey.com wrote: On 31/01/2012 01:02, Marty Knapp wrote: Thanks to those who responded to this. I was doing something similar to Dan's idea, but wondered if there was a way to use lineOffset or something else. I'll take a look at all the suggestions and continue on. I wish I could wrap my brain around regex - it all looks like a cat walked across my keyboard to my poor mind! [...] filter tmyList with (merge(*[[line 1 of tMerge]]*[[tab]]*[[line 2 of tMerge]]*[[tab]]*[[line 3 of tMerge]]*[[tab]]*[[line 4 of tMerge]]*)) That's funny...I was thinking the same thing when I saw the filter stuff above. *grin* -Ken __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode