First try with "Filter"

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

First try with "Filter"

Post by bjb007 » Sat Sep 06, 2008 4:35 pm

Haven't had any luck trying to do

filter vFour with vOne

Is it possible?

The error messages aren't any help.
Life is just a bowl of cherries.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Sun Sep 07, 2008 10:46 am

Well it's hard to judge the cause if all we have is a one-liner...
Is the Script Editor throwing an error during compilation? Is the result less than satisfactory?

What exactly are vFour and vOne?
Local variables? Global variables?

And what is in them?

The filter command allows you to 'filter' the lines of a 'container' on the basis of a filter pattern, which is a very limited version of regular expression syntax.

So what exactly is confusing or not working?
I'm sure we can help figure it out.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

First try with "Filter"

Post by bjb007 » Sun Sep 07, 2008 2:34 pm

The question was general.

Can a variable be filtered by another variable?

Assume that the contents of the variable are
suitable e.g.

vFour = 123

vOne = 1
Life is just a bowl of cherries.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Sun Sep 07, 2008 7:17 pm

That will work, but result in an empty var. Filter does look at each line, and if the line doesn't match the simplified regular expression you gave it, it will remove that line from the var. If you give it "1", it'll expect exactly that as a line, so "123" will not qualify.

A better example might be:

vFour = 1 & return & 2 & return & 3

vOne = 1

filter vFour with vOne = 1
filter vFour without vOne = 2 & return & 3
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

First try with "Filter"

Post by bjb007 » Sun Sep 07, 2008 10:52 pm

Thanks BvG.

There's a stack in my User Space
called "Filter" which shows how to
use the filter function.
Life is just a bowl of cherries.

Post Reply