<DIV>Hi:</DIV> <DIV> </DIV> <DIV>I am using Dbox and the example provided by Rich Greenwood, to map the results from a database query. I have modified the script so you can change the queryfile, qitem and qstring. The script works OK on 1 layer, but for others I get NaN. Before to map the results I test ( alert(qlayer, qitem, qstring)) to see if the queryfile, qitem and qstring are correct. Even though I have the core ct names for each one I still get NaN results</DIV> <DIV>What could be the problem?</DIV> <DIV> </DIV> <DIV>script from the database query results</DIV><FONT color=#0000ff size=2> <DIV><</FONT><FONT color=#800000 size=2>script</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>type</FONT><FONT color=#0000ff size=2>="text/javascript"</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>language</FONT><FONT color=#0000ff size=2>="javascript"></DIV></FONT><FONT size=2> <DIV></FONT><FONT color=#0000ff size=2>var</FONT><FONT size=2>
qlayer = </FONT><FONT color=#800000 size=2>"anyQlayer"</FONT><FONT size=2>;</DIV> <DIV></FONT><FONT color=#0000ff size=2>var</FONT><FONT size=2> qitem = </FONT><FONT color=#800000 size=2>"anyQitem"</FONT><FONT size=2>;</DIV></FONT><FONT size=2> <DIV></FONT><FONT color=#0000ff size=2>function</FONT><FONT size=2> map(qstring)</DIV> <DIV></FONT><FONT color=#008000 size=2>{</DIV></FONT><FONT size=2> <DIV>opener.itemQueryModified(qstring, qitem, qlayer);</DIV> <DIV>window.close();</DIV> <DIV>opener.focus();</DIV> <DIV>}</DIV></FONT><FONT color=#0000ff size=2> <DIV></</FONT><FONT color=#800000 size=2>script</FONT><FONT color=#0000ff size=2>></DIV></FONT> <DIV> </DIV> <DIV> </DIV> <DIV>modified itemQuery script </DIV> <DIV> 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=" + 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]), Number(tokens[2]), Number(tokens[3]), Number(tokens[4]));<BR> ms.setExtent(Number(tokens[1]), Number(tokens[2]), Number(tokens[3]), Number(tokens[4]));<BR> main.setImage(tokens[5]);<BR> ms.savedqueryfile=tokens[6];<BR> domouseclick('pan');<BR> }</DIV> <DIV> </DIV> <DIV> </DIV><p>
<hr size=1>Need Mail bonding?<br>Go to the <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">Yahoo! Mail Q&A</a> for <a href="http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091">great tips from Yahoo! Answers</a> users.