<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Comic Sans MS";
        panose-1:3 15 7 2 3 3 2 2 2 4;}
@font-face
        {font-family:"Lucida Sans Unicode";
        panose-1:2 11 6 2 3 5 4 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Comic Sans MS";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'>I use the
layer.connectiontype to adjust my query calls.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:240.0pt;
margin-bottom:0in;margin-left:60.0pt;margin-bottom:.0001pt;line-height:150%;
background:white'><font size=2 color=black face="Lucida Sans Unicode"><span
style='font-size:10.5pt;line-height:150%;font-family:"Lucida Sans Unicode";
color:black;letter-spacing:-.1pt'>Connection Types<o:p></o:p></span></font></p>

<p class=MsoNormal style='mso-margin-top-alt:2.25pt;margin-right:240.0pt;
margin-bottom:7.5pt;margin-left:96.0pt;line-height:150%;background:white'><font
size=2 color=black face="Lucida Sans Unicode"><span style='font-size:10.5pt;
line-height:150%;font-family:"Lucida Sans Unicode";color:black;letter-spacing:
-.1pt'>MS_INLINE, MS_SHAPEFILE, MS_TILED_SHAPEFILE, MS_SDE, MS_OGR,
MS_TILED_OGR, MS_POSTGIS, MS_WMS, MS_ORACLESPATIAL, MS_WFS, MS_GRATICULE,
MS_MYGIS, MS_RASTER, MS_PLUGIN<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'>For example:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>If layer.connectiontype == </span></font><font
size=2 color=black face="Lucida Sans Unicode"><span style='font-size:10.5pt;
font-family:"Lucida Sans Unicode";color:black;letter-spacing:-.1pt'>MS_SHAPEFILE</span></font><font
face="Courier New"><span style='font-family:"Courier New"'>) {<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; layer.queryByAttributes(map,
&quot;myfield&quot;, &quot;searchValue&quot;, mapscript.MS_MULTIPLE);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>} else {<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>&nbsp;&nbsp; layer.queryByAttributes(map, null,
&quot;myfield='searchValue'&quot;, mapscript.MS_MULTIPLE);<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Courier New"><span style='font-size:12.0pt;
font-family:"Courier New"'>}</span></font><br>
<br>
<font color=blue face="Comic Sans MS"><span style='font-family:"Comic Sans MS";
color:blue'><o:p></o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> mapserver-users-bounces@lists.osgeo.org
[mailto:mapserver-users-bounces@lists.osgeo.org] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Berend Veldkamp<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, January 22, 2010
7:22 AM<br>
<b><span style='font-weight:bold'>To:</span></b>
mapserver-users@lists.osgeo.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [mapserver-users]
queryByAttributes syntax</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi,<br>
<br>
Where can I find more information about the queryByAttributes() function? I
found <a href="http://mapserver.org/mapscript/php/index.html#layerobj-class">http://mapserver.org/mapscript/php/index.html#layerobj-class</a>
, but it is not very detailed. By trial and error I found that for a PostGIS
layer, I should use this syntax:<br>
<br>
</span></font><font face="Courier New"><span style='font-family:"Courier New"'>layer.queryByAttributes(map,
null, &quot;myfield='searchValue'&quot;, mapscript.MS_MULTIPLE);</span></font><br>
<br>
but for shapefiles, it seems it should be:<br>
<br>
<font face="Courier New"><span style='font-family:"Courier New"'>layer.queryByAttributes(map,
&quot;myfield&quot;, &quot;searchValue&quot;, mapscript.MS_MULTIPLE);</span></font><br>
<br>
I am trying to write some generic code, but that's hard if there is no single
way to call this method. Also, I haven't found a way yet to do a partial match
on a shapefile (PostGIS supports 'LIKE')<br>
<br>
Regards,<br>
Berend Veldkamp<o:p></o:p></p>

<p><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>No
virus found in this incoming message.<br>
Checked by AVG - www.avg.com<br>
Version: 9.0.730 / Virus Database: 271.1.1/2640 - Release Date: 01/23/10
02:33:00</span></font><o:p></o:p></p>

</div>

</body>

</html>