Select to view content in your preferred language

custom Reports using FLEX API

2608
12
06-15-2011 11:10 AM
jayshukla
Regular Contributor
Hi There,
I am looking into the possibility of building a web application based on FLEX api. I have some intial questions, I come from .NET development and curious how I can implement functionlaity like custom Reports, queries using oracle data sources.

Appreciate any thougths.     

Thanks
Jay
Tags (2)
0 Kudos
12 Replies
AaronNash
Deactivated User
Not sure how everyone else does it, but I linked some SQL tables to my parcel data, published it as a web service. Then wrote a query to to search the data, return the results into a datagrid, and then use alivePDF to publish the data into a PDF report. I have the app running in an I-frame on our town website http://www.vernon-ct.gov/propertycard
0 Kudos
jayshukla
Regular Contributor
Hi Aaron,
This is really encouraging that we can consume Web services. I am assuming that this webservice was a .NET web service. The application that I am designing will do something similar where it does a query and then creates a report.

I am new to flex development. As part of this project, i am trying to have most of the logic contained in web services and then calling then use the Flex API to show content on the web.

Are there any web resources that i could use as starting point for this flex and .NET interaction. I would really appreciate any input.

Thanks
Jay
0 Kudos
AaronNash
Deactivated User
Jay,

I am not sure what kind of data you are trying to consume in the service, I only wanted to publish data in 5 sql tables. So I added the tables to ArcMap, did a join by attribute to my parcel data, then published the MXD as a web service in ArcServer. I looked into creating a .net webservice, I also have no experience with .net, and it was easier to do it in ArcMap. I then used the ArcServer Flex API to run queries against the webservice. I have no need to access any of the spatial data, also in ArcServer 10 you can add tables to an MXD and publish them in a webservice and they show up like layers. I did it all in ArcServer 9.3.1, showing is my query function on my webservice
  //query function  
  private function doQuery():void
  {
   if (streetName.text == "")
   {
    Alert.show("Please Enter Text", "User Error");
   }
   else 
   {
   progressBar.visible = true;
   var query:Query = new Query();
   var pExpr:String = streetName.text.toUpperCase();
   pExpr = pExpr.replace(",","");
   pExpr = pExpr.replace("-","");
   pExpr = pExpr.replace(".","");
   var expr:String = queryExpr.replace("[value]", pExpr)
   query.where = expr;
   query.outFields = ["*"]
   query.returnGeometry = false;
   queryTask.execute(query, new AsyncResponder(onResult, onFault));
   function onResult(featureSet:FeatureSet, token:Object = null):void
   {
    progressBar.visible = false;
   }
   function onFault(info:Object, token:Object = null):void
   {
    progressBar.visible = false;
    Alert.show("No parcels were found", "Try something else");
   }
   }
  //enable radion buttons to switch
  private function changesearch(event:ItemClickEvent):void
  {
   switch(event.label.toLowerCase())
   {
    case "street": 
    {
     txtLabelText.text = "Search Parcels by Street Name ex. Park Pl"
     queryExpr = "LocAddr LIKE '%[value]%'";
     autoCompleteMgr.enabled = true;
     break;
    }
    case "owner":
    {
     txtLabelText.text = "Search Parcels by Owner Name (Last Name First) ex. Smith John"
     queryExpr = "Owner1 LIKE '%[value]%'";
     autoCompleteMgr.enabled = false;
     break;
    }
   }
  }
  }
0 Kudos
jayshukla
Regular Contributor
This is great, Thanks for the sample code. This certainly gets me started.

Thanks again for taking time to help me out. 

Jay
0 Kudos
City_ofTrail
Emerging Contributor
Hi Aaron,
I am wanting to do the same. how do you generate report as it looks when you print it.

Mark
0 Kudos
AaronNash
Deactivated User
attached is the code I used to generate the report, I used alivePDF.
0 Kudos
MGSethe
Deactivated User
Hello, Thanks for posting your code. I am not a developer and i was wondering if you can not post the full Code with the associated MXML file. I need to implement the same functionality but i am stucked.I think this will help me to get my site running.
Please help.
0 Kudos
City_ofTrail
Emerging Contributor
Thank you for th bit og code Aaron,
This poitns in the right direction.
0 Kudos
AaronNash
Deactivated User
Attached is the main mxml code for the site, it is totally custom for my application. I have components that are not visible because i am binding features between the two, not the correct way to code but worked for my application. It started as a ESRI flex sample
0 Kudos