Census 2010 reports with SimpleRings Task Problem

1775
5
01-05-2012 09:21 AM
AmyWright_Webber
New Contributor III
Hello,

Is anyone else encountering this problem?  My SimpleRings task does not return a report when I run it against the new census2010 dataset but it does return a report when I run it against the original USA dataset.

Any ideas or assistance is greatly appreciated!

Thanks!

Amy

Verisons:
ArcGIS Flex API - 2.4
BA Online Flex API - 2.1

More Details:
I have two radio buttons where the user selects whether they want to see the list of available reports available from Census 2000 (activeDatasetID set to USA) or from Census 2010 (activeDatasetID set to USACensus2010)

The only difference in the code is the value stored in my _activeDataSet variable. 

When I use the USA dataset, the returned array has a report in it.  When I use the USACensus2010 dataset, the returned array is null.  The code calling the report is below:

//_baClient contains my BAO login information
var simpleRingsTask : SimpleRingsTask  = new SimpleRingsTask(_baClient);
simpleRingsTask.execute(params, new mx.rpc.Responder(resultHandlerRings, faultHandler));

//

private function resultHandlerRings(event:BATaskCompletedEvent):void
 {
 var taskResultOutput : TaskResultOutput = event.result as TaskResultOutput;

  //draw the features on the map
  var fs : FeatureSet = taskResultOutput.recordSet;
  if(fs)
  {
   // add the resulting features to map
     for (var i:Number = 0; i < fs.features.length; i++) 
   {
   var g : Graphic = fs.features;
   // set tooltip from attributes
   g.toolTip = fs.features.attributes["AREA_DESC2"];
   g.autoMoveToTop = false;
   _graphicsLayerRings.add(g);
   }
     
   zoomToExtent();
    
  }
  //get the report
// taskResultOutput is empty when 2010 dataset used and the following error is thrown - 
// it all works great with the USA dataset
// TypeError: Error #1009: Cannot access a property or method of a null object reference.
  var reportInfo : ReportInfo = taskResultOutput.reports[0];
  _reportUrl = reportInfo.url;
    
  lblGuide.text = "Task complete. " +
  "The summary report has been generated and is ready for download."
    cursorManager.removeBusyCursor();
    
                          navigateToURL(new URLRequest(_reportUrl), "_blank");
    
             }
0 Kudos
5 Replies
MehakSujan
New Contributor
Hi Amy,

What report template are you trying to use? It is possible you are using a report template that is only available in the USA dataset.

Also, keep in mind that the USA and USACensus2010 datasets are based on completely different USA geographies and it is highly recommended to not compare them against each other.

Thanks,
Mehak
0 Kudos
AmyWright_Webber
New Contributor III
Hello Mehak,

The reports are being generated for custom geographies (1 mile radius, 10 min drivetime etc) and the users are simply being given the choice on whether they want to use the 2010 available reports or some of the more specialized reports that are currently only available using the 2000 census and associated projections.   

I am using the names returned by the GetReportTemplatesTask so for the USACensus2010 dataset - I am setting the activeDatasetID to "USACensus2010" and then populating a dropdown box with the report names as returned by GetReportTemplatesTask. I am getting the following two report names for this dataset -

Census 2010 Profile (2010 Geography)
Demographic and Income Profile  (2011 Data)

When I submit the request for the report, I submit the name as shown below.

var option:ReportOptions = new ReportOptions();
// set the template name to the selected report template from user combobox
option.templateName = reportTemplate.name


Thanks!

Amy

Hi Amy,

What report template are you trying to use? It is possible you are using a report template that is only available in the USA dataset.

Also, keep in mind that the USA and USACensus2010 datasets are based on completely different USA geographies and it is highly recommended to not compare them against each other.

Thanks,
Mehak
0 Kudos
AmyWright_Webber
New Contributor III
Update - I think I have it fixed.  I will post the syntax once I confirm what I did that worked! 

Thanks!

Amy
0 Kudos
MehakSujan
New Contributor
Great to hear that! I think you may have just forgotten to set 'activeDatasetID' property on the SimpleRingsTask and hence wasn't getting any results back. See the section in Concepts 'Using Additional Datasets' for additional information - http://help.arcgis.com/en/businessanalyst/online%20apis/apis/flex/concepts/datasets.html.
0 Kudos
AmyWright_Webber
New Contributor III
I was just browsing the forums and realized that I had not posted back to this thread to verify that this was the solution so I thought I would correct that oversight. I was using the activeDataSet ID to get my report template list but was not specifically setting it with the parameters for the SimpleRingsTask - the second line of code below was the one I was missing. 

    
var params : SimpleRingsParameters = new SimpleRingsParameters(outputTypes);
     params.activeDatasetID = _activeDataSet



FYI - _activeDataSet is the variable that is selected by the user when they pick whether they want the 2000 group of reports or the 2010 report listing
 
 // determines the group of available report titles
   [Bindable]
   //private var _activeDataSet:String = "USA" or "USACensus2010"; 
   private var _activeDataSet:String = "USACensus2010";


Thank you Mehak!
0 Kudos