<DIV>As usually: Thank you Rich</DIV> <DIV>The strange part is that I have a match in my database, but I still get the NaN results. If I use the query tool from mapserver I get the proper results.<BR>The only difference is that when I send text (the qstring is a text) from the database to mapserver I get the proper results. When I send numbers (the qstring is a number) I get NaN results. Do you think it could be related to the type of the data used for query?</DIV> <DIV> </DIV> <DIV>I will make other tests</DIV> <DIV> </DIV> <DIV>William</DIV> <DIV> </DIV> <DIV><BR><B><I>Richard Greenwood <richard.greenwood@gmail.com></I></B> wrote:</DIV> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On 3/20/07, william paul <WILLIAMPAUL28@YAHOO.COM>wrote:<BR>> Hi:<BR>><BR>> I am using Dbox and the example provided by Rich Greenwood, to map the<BR>> results from a database query. I have modified
the script so you can change<BR>> the queryfile, qitem and qstring. The script works OK on 1 layer, but for<BR>> others I get NaN. Before to map the results I test ( alert(qlayer, qitem,<BR>> qstring)) to see if the queryfile, qitem and qstring are correct. Even<BR>> though I have the core ct names for each one I still get NaN results<BR>> What could be the problem?<BR>><BR>> script from the database query results<BR>> <SCRIPT language=javascript type=text/javascript><br>> var qlayer = "anyQlayer";<br>> var qitem = "anyQitem";<br>> function map(qstring)<br>> {<br>> opener.itemQueryModified(qstring, qitem, qlayer);<br>> window.close();<br>> opener.focus();<br>> }<br>> </SCRIPT> <BR>><BR>><BR>> modified itemQuery script<BR>> ms.itemqueryoptions = "&mapext=shapes&savequery=true&";<BR>> function itemQueryModified(qstring, qitem, qlayer)<BR>> {<BR>> //ms.setLayer(qlayer, true);<BR>> var uri = ms.mapserver + '?map='
+ ms.mapfile + "&layers=" +<BR>> ms.getLayers("+") + "&mapsize=" + ms.width + "+" + ms.height;<BR>> uri += ms.itemqueryoptions;<BR>> uri += '&mode=itemquery'<BR>> uri += '&qlayer=' + qlayer;<BR>> uri += '&qitem=' + qitem;<BR>> uri += '&qstring=' + qstring;<BR>> var response = get_content(uri);<BR>> var tokens = response.split(',');<BR>> alert(qstring + qitem + qlayer + ", " + Number(tokens[1]),<BR>> Number(tokens[2]), Number(tokens[3]), Number(tokens[4]));<BR>> ms.setExtent(Number(tokens[1]), Number(tokens[2]), Number(tokens[3]),<BR>> Number(tokens[4]));<BR>> main.setImage(tokens[5]);<BR>> ms.savedqueryfile=tokens[6];<BR>> domouseclick('pan');<BR>> }<BR><BR>You probably didn't get a match in your database. NaN means "Not a<BR>Number". MapServer did not return an extent for the selection because<BR>it could not find anything, and so your browser was not able to<BR>convert the tokens 1-4 into
numbers.<BR><BR>I try to catch that and tell the user something like "no results found".<BR><BR>Rich<BR><BR>-- <BR>Richard Greenwood<BR>richard.greenwood@gmail.com<BR>www.greenwoodmap.com<BR></BLOCKQUOTE><BR><p>
<hr size=1>It's here! Your new message!<br>Get
<a href="http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/"> new email alerts</a> with the free <a href="
http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/">Yahoo! Toolbar.</a>