Cards vs Listfield/custom properties revisited

Jim Ault JimAultWins at yahoo.com
Thu Jan 24 17:56:30 EST 2008


And don't forget the technique of
tab (or comma or other delimited) in the lines

put tab into t
> put gData into tFilteredData
replace null with empty in tFilteredData
filter tFilteredData with ("*"&t&"*"&t&"*"& theStringYouWant &"*"&t&"*"
-- data will be contained in the third column
--  not the 1st, 2nd, 4th or any following the 4th
--   ie  (      *|*|*end of day*|*   ) will be the filter

Patterns for the filter command are wild cards, not regex
A null will stop the filter from working

if you use this a lot then add this abstraction
put ("*"&tab) into c
filter tFilteredData with (c&c&"*"& theStringYouWant &"*"&c&"*"
-- data will be CONTAINED in the third column
--  not the 1st, 2nd, 4th or any following the 4th
--   ie  (      *|*|*end of day*|*   ) will be the filter


filter tFilteredData with (c&c& theStringYouWant &c&"*"
-- data must MATCH the third column
--   ie  (      *|*|end of day|*   ) will be the filter

filter tFilteredData with (c&c&"*"& theStringYouWant &c&"*"
-- data must START the third column
--   ie  (      *|*|end of day*|*   ) will be the filter

filter tFilteredData with (c&c& theStringYouWant &"*"&c&"*"
-- data must END the third column
--   ie  (      *|*|*end of day|*   ) will be the filter

Jim Ault
Las Vegas

On 1/24/08 2:01 PM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

>> While this has always been fast enough for me, I am trying to learn
>> better ways to do things, but after trying such things as filter with
>> or match etc, I have found no way do something that has the same
>> result as "mark cards where ...". Is there anything that would have
>> the effect of the (apparently not possible) command "mark lines in it
>> where ..."? I suppose it would look something like this:
>> 
>> put the mData of this stack into gData --loads that big custom prop
>> somehow get rid of lines where something is not in a certain item of
>> those lines
>> set the tempData of this stack to gData
>> do things with the tempData of this stack
> 
> The filter command could be very useful here.
> e.g.
> put gData into tFilteredData
> filter tFilteredData with "*" & theStringYouWant & "*"
> 
> This gives you all the lines containing your required string. You can
> then do Jacque's suggestion of looping through and finding the exact
> item matches, but this will do a first search that will reduce the
> number of lines.





More information about the use-livecode mailing list