Multiple attribute query with a regular expression.

Erv McNally erv.mcnally at GMAIL.COM
Thu Apr 7 16:12:47 EDT 2005


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