Select to view content in your preferred language

Porting 1.3 to 2.1 pass URL parameter code help needed.

1953
0
10-27-2010 01:32 PM
LeeAllen
Frequent Contributor
I am working on porting code from 1.3 to 2.1 to pass URL parameters initially set up from http://forums.arcgis.com/threads/4018-SFV-1.3-Pass-URL-to-Search-parcels, among others.  I just about have everything worked out, except some errors in the search widget when I copied code.  Any help with the following would be awesome (again...).

Pasted this code from 1.3 Search Widget to 2.1 Search widget:
//RSheitlin external linking mod            
            //query parameter
            public function queryPID(sParam:String):void
            {
                
                var i:Number = cboLayerText.selectedIndex;
                queryLayer = "http://gis.snco.us/ArcGIS/rest/services/Cadastral/MapServer/18";
                queryExpr = "PID = '[value]'";
                queryFields = "PID,ONAME,PADDRESS,PADDRESS2,WebLink";
                queryTitleField = "PID";
                queryLinkField = "WebLink";
                queryMultiImgField = "";
                
                wFields = new ArrayCollection;
                var wFlds:Array = queryFields.split(",");
                for (var x:int=0;x<wFlds.length;x++){
                    var obj:Object = 
                        {
                            fldn: wFlds,
                            index: x
                        }
                    wFields.addItem(obj);
                }
                
                if (queryLayer)
                {
                    var queryTask:QueryTask = new QueryTask(queryLayer);
                    var query:Query = new Query();
                    var pExpr:String = sParam.toUpperCase();
                    var expr:String = queryExpr.replace("[value]", pExpr);
                    query.where = expr;
                    query.outFields = queryFields.split(",");
                    query.returnGeometry = true;
                    query.outSpatialReference = map.spatialReference;
                    queryTask.execute(query, new AsyncResponder(onResult, onFault));  
                    showMessage(loadingLabel, true); 
                    showStateResults(null);
                    
                    //showStateResults;   
                    
                    // on result
                    function onResult(featureSet:FeatureSet, token:Object = null):void                
                    {   
                        try
                        {
                            var recAC:ArrayCollection = createRecordData(featureSet);
                            addSharedData(widgetTitle, recAC);
                            wRepeater.dataProvider = recAC;
                            showMessage(selectionLabel + " " + featureSet.features.length, false); 
                            //onLoadDone(null); //specific to something else of Robert's
                            map.cursorManager.removeAllCursors();
                            //now zoom to the parcel
                            var pt:MapPoint = recAC[0].point;
                            if (map.scale > zoomScale)
                                map.scale = zoomScale;
                            map.centerAt(pt);
                        }
                        catch (error:Error)
                        {
                            showMessage(error.message, false);
                            //onLoadDone(null); //onLoadDone(null); //specific to something else of Robert's
                        }
                        
                    }
                    
                    //on fault
                    function onFault(info:Object, token:Object = null) : void
                    {      
                        //onLoadDone(null);  //onLoadDone(null); //specific to something else of Robert's            
                        showMessage(info.toString(), false);         
                    }
                }  
            }
            //RSheitlin external linking mod end
currently getting these errors:
queryFields = "PID,ONAME,PADDRESS,PADDRESS2,WebLink"; (1067: Implicit coercion of a value of type String to an unrelated type XMLList.)   

showStateResults(null); (1137: Incorrect number of arguments.  Expected no more than 0.)

var recAC:ArrayCollection = createRecordData(featureSet); (1180: Call to a possibly undefined method createRecordData.)

wRepeater.dataProvider = recAC; (1120: Access of undefined property wRepeater.)

Will attach whole file if needed.
Tags (2)
0 Kudos
0 Replies