Search Values of Array in "One Go"

Brian Milby brian at milby7.com
Sat Aug 26 00:05:17 EDT 2017


tElement isn't the part that would change (you are still searching against
a single value in the array), you would need to modify the comparison to
allow for pNeedle to contain multiple values and the operators.  It would
probably be easier to modify to use a RegEx.  If you have 2 comma separated
items, you could use something like the following (I'm sure the more
experienced can offer much better ways though):

*if* (tElement contains item 1 of pNeedle) or (tElement contains item 2 of
pNeedle) *then*

On Fri, Aug 25, 2017 at 10:41 PM, Sannyasin Brahmanathaswami via
use-livecode <use-livecode at lists.runrev.com> wrote:

> OK I will bite
>
> what would an array representing an "AND/OR"
> style query look like such that if used as a predicate
>
> for
>
>      else if tElement contains pNeedle then
>
> it would return true/false
>
> How would you have to construct "tElement"
>
> ??
>
>
>
> Mark: In terms of generalizing that function - then the key line which
> checks
> whether an element matches is:
>
>      else if tElement contains pNeedle then
>
>
>     One could imagine that this could be an arbitrary predicate - pNeedle
>     doesn't have to be a string, so could be an array representing a AND /
>     OR style query; or could be a regex (in which case you'd use
> matchText).
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list