POST
|
I don't use the widzards but write my own code to do this. Depending on you code skill level this process is pretty essay. Step 1: Create .net web service to return data table. Step 2: Create flex class for calling web service. Step 3: Call service Step 4: work with results. I have attached some code and below is an example of getting results to an ArrayCollection. If you are returning an array of tables you may have to loop through the results and assign each table to an array collection. The key is to understand the how the results are being returned and this depends on the .net code. in this case below my .net code returns a data table. If you need more help my email is david.galluzzo@dhs.gov //gets Spot Incidents in system and stores inside array public function gotSpotIncidents(e:ResultEvent):void{ if(e.result.Tables.Table.Rows.length > 0){ var table:* = e.result.Tables.Table.Rows; spotIncidentsArr = new ArrayCollection(); spotIncidentsArr = table; // Assign Results to branches Array } CursorManager.removeBusyCursor(); }
... View more
12-02-2010
06:17 AM
|
0
|
0
|
205
|
POST
|
nasif, you can work with SQL and other databases in flex by using a web service. You will have two sets of code. In my case I use C# .net to create a web service that returns a datatable. Once you get the results, you can assign them to an Array collection in Flex. C# Code /// <summary> /// get Owners from Database /// </summary> /// <returns>DataTable</returns> [WebMethod] public DataTable getOwners(string search) { try { // create sql connection SqlConnection DbConnect = new SqlConnection(conString); SqlCommand sqlCmd = new SqlCommand(); sqlCmd.Connection = DbConnect; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "sp_getOwnersSearch"; //run query to fill dataset ds = new DataSet(); da = new SqlDataAdapter(sqlCmd); da.SelectCommand.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@Search", search); // add @User parameter da.Fill(ds, "Table"); return ds.Tables["Table"]; } catch (Exception ex) { throw CreateSafeException(ex); } } Flex Code import mx.rpc.soap.WebService; import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private var gateway:WebService = new WebService(); public var ownersArr:ArrayCollection = new ArrayCollection(); // Holds All Owners // Call .net web service public function searchOwners(search:String):void { CursorManager.setBusyCursor(); // Set Cursor ownersArr.removeAll(); gateway.wsdl = "http://localhost/FlexAppBuilder_WS/Service1.asmx?wsdl"; // Path to Web service gateway.loadWSDL(); gateway.getOwners.addEventListener(ResultEvent.RESULT, gotOwnersSearch); // Add Event listner gateway.addEventListener(FaultEvent.FAULT, faultHandler); gateway.getOwners(search); // Call getOwners Web Service } //gets Owners in system and stores inside array public function gotOwnersSearch(e:ResultEvent):void { if(e.result.Tables.Table.Rows) { var table:* = e.result.Tables.Table.Rows; ownersArr = table; // Assign Results to owners Array } CursorManager.removeBusyCursor(); // Remove Busy Cursor } / fault handler public function faultHandler(e:FaultEvent):void { CursorManager.removeBusyCursor(); Alert.show(e.fault.faultString); } Hope this helps
... View more
08-19-2010
09:39 AM
|
0
|
0
|
199
|
POST
|
These packageshave been moved to in the 2.o framwork com.esri.ags.layers.supportClasses Supporting classes in the Layers package has moved into a subpackage com.esri.ags.layers.supportClasses. (see Migrating from 1.3 to 2.0)
... View more
08-18-2010
04:04 AM
|
0
|
0
|
166
|
POST
|
try using ArcGISDynamicMapServiceLayer.layerDefinitions. I use this to set layer definitions at run-time. Not sure if it displays layer Definitions defined from the MXD but know it will display layer definitions defined at run-time.
... View more
08-10-2010
10:08 AM
|
0
|
0
|
524
|
POST
|
Manolo, I did a rewrite of the TOC classes to change the way they work with group layers. Currently when you turn on a group layer, it turns on all sub layers. This does not work for me as some of my group layers contain lots of sub layers. My code will turn on the parent of the group layer when a sub layer is turned on but in will not turn on the main map service. I am not sure how it will work if the group layers are services but you can give it a try. I had to make changes to all the classes in the TOCClasses folder. I suggest saving the original classes before trying this code.
... View more
07-28-2010
04:24 AM
|
0
|
0
|
542
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|