steinj14

Error using ESRI Print Task service

Discussion created by steinj14 on Feb 28, 2013
Latest reply on Feb 25, 2014 by Meengla
Hi,

I'm encountering an error using the ESRI print task (http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task) that I'm having trouble resolving.

My app is here: http://gis.tpcmaps.org/apps/staging/pima

The error only occurs after the data grid is dislplayed (e.g., via the app's Find Parcel functionality) and I then try to Print.

The apps returns the error:

[INDENT](in Firebug): TypeError: cyclic object value
...="'")){_2f3.matchFor=cmf.slice(1,-1);}}_2f2.attrs.push(_2f3);_2f3=null;_2eb=_2ed...

(in IE developer tools): SCRIPT5034: Circular reference in value argument not supported
PrintTask.js, line 19 character 2208[/INDENT]


The relevant code is:

function doFindParcel(searchText) {
 console.log("-->inside doFindParcel");
   //create query task with url to map service.
 var queryTask = new esri.tasks.QueryTask(configOptions.parcellayer);
 var query = new esri.tasks.Query();
 query.returnGeometry = true;
 query.outSpatialReference = map.spatialReference;
 query.outFields = configOptions.parceloutfields;
 
 console.log("searchText: " + searchText);
    //set the search text to find parameters
    //findParams.searchText = searchText;
 searchby = dijit.byId('searchby').value;
 searchfor = searchText.trim(); //trim the string in case user puts leading spaces in.
 console.log("searchby: " + searchby + ", searchfor: " + searchfor);
 //Search for the keyword at the beginning of the field so it will use the indexes.
 //If search with the wildcard in the front, it does a complete table scan which is slow.
 switch (searchby) {
  case "folio":
     //query.where = "OBJECTID = 1";
     //query.where = "[FOLIO] = '194001.0000'"; 
     //query.where = "[FOLIO] = '" + searchfor + "'"; 
     query.where = "[FOLIO] like '" + searchfor + "%'"; 
     break;
  case "owner":
     query.where = "[OWNER1] like '" + searchfor + "%'";
     break;
  case "site_addr":
     query.where = "[STR_NAME] like '" + searchfor + "%'";
     break;          
 }
 console.log("query where: " + query.where);
    //Show the dialog box to containing "searching" message (so user knows app is doing something).
 dijit.byId("searchingDialog").show();
    queryTask.execute(query, showParcelResults, showParcelError);
}
  
function showParcelResults(results) {
 console.log("-->inside showParcelResults");
   //resultcount = results.length; //this worked for the FindTask, but not for QueryTask.
   //think query task returns result objects but find task returns features?
   resultcount = results.features.length;
   console.log("# of query result objects passed into function: " + resultcount);
   features = results.features;

 //Close the 'searching' dialog box. 
 dijit.byId("searchingDialog").hide();

 if (resultcount > 0) {
  //console.log("-->inside resultcount loop");
  //Open the dialog box to display results in a grid. 
  showResultsGrid(features);   
 }
 //Alert user in case parcel is not found, 9/11/12 jms.
 else {
  dialogAlert("Find Parcel", searchby + ": " + searchfor + " was not found.");
 }
}

function showParcelError(error) {
 //Close the 'searching' dialog box. 
 dijit.byId("searchingDialog").hide();
 console.log("Find Parcel", "Error in 'Find Parcel': " + error);
 dialogAlert("Find Parcel", "Error in 'Find Parcel': " + error);
}

//Zoom to the parcel when the user clicks a row
function onRowClickHandler(evt){
 console.log("-->inside onRowClickHandler");
    var clickedTaxLotId = grid.getItem(evt.rowIndex).FOLIO;
    var selectedTaxLot;
    var symbol = new esri.symbol.SimpleFillSymbol(highlightfillSymbol);

    dojo.forEach(map.graphics.graphics,function(graphic){
      if((graphic.attributes) && graphic.attributes.FOLIO === clickedTaxLotId){
       //Setting the symbology here sets it for only the feature clicked on.
  graphic.setSymbol(symbol);
        selectedTaxLot = graphic;
        return;
      }
    });
    var taxLotExtent = selectedTaxLot.geometry.getExtent();
    map.setExtent(taxLotExtent);
}

function showResultsGrid(features) {
 //This function works with an array of result that the task returns
 console.log("-->inside showResultsGrid");
 console.log("# of features passed into function: " + features.length);
 var resultcount = features.length;


 //Open the dialog box to display results in a grid.   
 dijit.byId("parcelresultsDialog").show();
 
 //Display number of results in the dialog box header.
 dojo.byId('rowcountdisplay').innerHTML=resultcount+" parcels.<br/>"+ configOptions.selectparcelnote + configOptions.maxrecordcount + ".";
 
 //map.graphics.clear();
 //clearAllGraphicsLayers();
 
 //var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 2), new dojo.Color([98, 194, 204, 0.5]));
 var symbol = new esri.symbol.SimpleFillSymbol(resultfillSymbol);

 //create array of attributes and add graphic to map.
 items = dojo.map(features, function(feature){
  //console.log("-->inside create array of attributes");
  //var graphic = result.feature;
  var graphic = feature;
  //Setting the symbology here sets it for all features in results.
  graphic.setSymbol(symbol);
  map.graphics.add(graphic);
  //console.log("after adding graphic");
  return feature.attributes;
 });
 
 //Create data object to be used in store
 var data = {
  identifier: "FOLIO", //This field needs to have unique values
  label: "FOLIO", //Name field for display. Not pertinent to a grid but may be used elsewhere.
  items: items
 };
 
 //Create data store and bind to grid.
 var store = new dojo.data.ItemFileReadStore({ 
  data: data
 }); 
 
 //Grid used in the results pop-up dialog.
 grid = dijit.byId('grid');
 grid.setStore(store);
 
 //Grid used for exporting the data (containing additional fields) to a csv file.
 var gridexport = dijit.byId('gridexport');
 gridexport.setStore(store);
 
}


I have no idea what the problem is or how to debug this. Can anyone assist or offer suggestions?

Thanks in advance,
Joan

Outcomes