filter command syntax

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
slindstrom
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 29
Joined: Mon Apr 09, 2012 8:53 pm

filter command syntax

Post by slindstrom » Thu Mar 13, 2014 1:48 am

Help! What is wrong with my syntax in using the filter command in these two instances?

filter VarOne with VarTwo

VarOne is a variable containing lines of tab-delimited text, including some lines that contain the string that's stored in the VarTwo variable? After the command above VarOne is always empty even though, seems to me, it shouldn't be.

filter field "test field" with varTwo

Same result. field 'test field" contains the same data as in the first attempt to use filter above. The command filters field "test field" to empty even though the string in varTwo most definitely occurs on some of the lines.

What is wrong? I've written some scripts in which the filter command works as intended, but in many other instances I've had to resort to running through the data line by line and deleting any lines that don't contain the intended string. A less elegant approach; at least I can get it to work. Any suggestions?

Thanks in advance,
Sieg

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: filter command syntax

Post by Simon » Thu Mar 13, 2014 2:16 am

Hi Sieg,
Make sure you have wildcards in place
varTwo shold look like
*linetoFind*

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

slindstrom
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 29
Joined: Mon Apr 09, 2012 8:53 pm

Re: filter command syntax

Post by slindstrom » Thu Mar 13, 2014 10:05 pm

Thanks, Simon.

Now I get it.

Have to say it's a bit hard to conceptualize what the LiveCode Dictionary's explanation of the * wildcard means ("Matches zero or more of any character") when the * wildcards bracket the string.

Sieg

Post Reply