Page 1 of 1

using "any line of field "x"??

Posted: Wed Aug 08, 2012 5:24 am
by scotttyang
I thought this is suppose to be straight forward. for example, I have a list in a fld, and if a word is EQUAL to ANY line in this field, then I can move on, eg.

correctword = green

fld "wordlist" contains

green
green beans
green onion
green marker

the syntax is:
if correctword = any line of fld "wordlist" then do something

I was using ....if correctword is in fld "wordlist" but then all the other 4 lines with green was selected....so I thought = to any line of fld "wordlist" would work, but this did not. ANy thoughts? make sense?

Re: using "any line of field "x"??

Posted: Wed Aug 08, 2012 8:42 am
by shaosean
The way you tried should make sense based on the English language, but in the x-talk language the any keyword means to randomly select a line..
Documentation wrote:Use the any keyword to specify a random object of a specified type, or to designate a random chunk in a chunk expression.

Your initial method was almost correct.. You first need to set the wholeMatches property to true and then check if your word is among the lines of the field..

Code: Select all

set the wholeMatches to true
if (correctword is among the lines of field "wordlist") then do something