Multiple attribute query with a regular expression.

Erv McNally erv.mcnally at GMAIL.COM
Fri Apr 8 08:22:30 EDT 2005


Thank you, Ryan,

I was not using =~.  The pattern binding operator.  Everything works great now.

Thanks again,

Erv
>
> Erv,
>
> Are you using =~ when using regular expressions?  Also, try using an
> uppercase OR.
>
> Adam
>
>
> > -----Original Message-----
> > From: Erv McNally [mailto:erv.mcnally at GMAIL.COM]
> > Sent: Thursday, April 07, 2005 1:13 PM
> > To: MAPSERVER-USERS at LISTS.UMN.EDU
> > Subject: [UMN_MAPSERVER-USERS] Multiple attribute query with
> > a regular expression.
> >
> >
> > I currently can use PHP mapscript to query multiple
> > attributes using queryByAttributes($qitem,$qstring,MS_MULTIPLE);
> > $qitem='att1'
> > $qstring=('[att1]'='test' or '[att1]' = 'test2' and '[att3]'='test3')
> >
> > I also can use a regular expression to query on a single
> > attribute by setting the $qitem='att1' $qstring='/^[Tt].*/'
> > to search for all records with att1 that starts with a T or t.
> >
> > The problem is that I can't seem to find any way to query on
> > different attributes while using a regular expression as
> > follows. $qitem='att1' $qstring=('[att1]' = '/^[Tt].*/' or
> > '[att2]'='test2')
> >
> > I have not been able to make the above work by using any of
> > the following and many other combinations. $qstring=('[att1]'
> > = /^[Tt].*/ or '[att2]'='test2')  with error
> > msDBFGetItemIndex(): Item 'Tt' not found. $qstring=('[att1]'
> > = '/^[Tt].*/' or '[att2]'='test2')  with error
> > msDBFGetItemIndex(): Item 'Tt' not found. $qstring=('[att1]'
> > = '/^[Tt].*/')  with error msDBFGetItemIndex(): Item 'Tt' not
> > found. $qstring=('[name]' = /^T.*/)  with error
> > msEvalExpression: Failed to parse expression
> >  msyyparse(): syntax error.
> >
> > The last one seems like the expression is trying to be parsed.
> >
> > This wouldn't be necessary if there was a way to intersect
> > querys or to do a sub query on results from a prior query.  I
> > know that you can add features by using querybyIndex, but
> > that would be a union and I am interested in the
> > intersection.  Any information or insights would be greatly
> > appreciated.
> >
>



More information about the mapserver-users mailing list