Select to view content in your preferred language

retreiving data from SQL table

794
5
05-26-2010 07:04 AM
RichardKrell
Emerging Contributor
Problem:
currently I am using the code below to retreive information from a shapefile whenever the user does an Identify (point and click) however they now want to read a SQL database table to retrieve the data and I haven't been able to get it to work using an Infosymbol.

Can anyone point me into a different direction to enable 1. do an identify 2. have a window popup when you select a feature with the data coming back from a SQL table.

    <esri:InfoSymbol id="drcogInfoSymbol">
      <esri:infoRenderer>
        <mx:Component className="infoWindowRenderer"
          xmlns:mx="http://www.adobe.com/2006/mxml">
     
          <mx:VBox backgroundColor="0xEEEEEE">
           <mx:CurrencyFormatter id="infoCurrencyFormatter"
precision="0"
currencySymbol="$"
thousandsSeparatorFrom=","
thousandsSeparatorTo=","
useThousandsSeparator="true"/>

             <mx:HBox width="100%" backgroundColor="0xC6C6C6" height="20" alpha="0.5">
              <mx:Label text="TIP ID:  {data.PROID}" fontWeight="bold"/>
              <mx:Spacer width="100%"/>
             </mx:HBox>
             <mx:Label text="Agency: {data.PROGRAMMIN}"/>
             <mx:Label text="Abbrev. Description:" paddingBottom="0"/>
             <mx:TextArea
              wordWrap="true"
              paddingTop="0"
              width="370"
              borderStyle="none"
              backgroundAlpha="0.0"
              text="{ABBREV_LOC}"/>
             <mx:Label text="Work Being Done: {data.ALL_WORK_T}"/>
             <mx:Label text="Current Funding: {data.MYBONLY}"/>
             <mx:Label text="Completion: {data.COMPLETION}"/>
             <mx:Label text="Type: {data.OVERALL_TY}"/>
             <mx:Label text="ARRA: {data.MODELED}"/>
             <mx:Label text="Contact: {data.CONTACT}"/>
             <mx:Label text="Contact At: {data.CONTACT_AT}"/>
             <mx:Label text="Total Cost: {infoCurrencyFormatter.format(data.TOTAL_COST)}"/>
          </mx:VBox>
        </mx:Component>
      </esri:infoRenderer>
    </esri:InfoSymbol>
Tags (2)
0 Kudos
5 Replies
ChrisMahlke
Deactivated User
Do you have more code available to post (e.g. HTTPService, or rpc calls)?  Do you simply want to retrieve data from a db and display it in a table w/in an InfoWindow?
0 Kudos
RichardKrell
Emerging Contributor
I am simply trying to retrieve data from the db table based on an ID.  the following is my HTTPService code

<!-- ///////////////////////////////////////////////////////////////////////////// -->
 
    <mx:HTTPService id="hsID"
     url="http://data.cmap.illinois.gov/ws/tip/tipservice.asmx/getproject"
     showBusyCursor="true"
     requestTimeout="120"
     fault="showAlert(event)"/>
     
<!-- ///////////////////////////////////////////////////////////////////////////// -->  

This service is working great when I type in the ID but when I use the InfoSymbol - infoRenderer - Component it doesn't see the service and I can't put the code inside of the component.  Hope that answers your question
0 Kudos
AlexJones
Emerging Contributor
If you can post your script block I think we can help you a bit more. Your service seems fine, but you may not be handling the result correctly. If you could show us how you are sending/returning the data from the service we should be able to link this to your info window component.
0 Kudos
ZahidChaudhry
Deactivated User
I am simply trying to retrieve data from the db table based on an ID.  the following is my HTTPService code

<!-- ///////////////////////////////////////////////////////////////////////////// -->
 
    <mx:HTTPService id="hsID"
        url="http://data.cmap.illinois.gov/ws/tip/tipservice.asmx/getproject"
        showBusyCursor="true"
        requestTimeout="120"
        fault="showAlert(event)"/>
        
<!-- ///////////////////////////////////////////////////////////////////////////// -->  

This service is working great when I type in the ID but when I use the InfoSymbol - infoRenderer - Component it doesn't see the service and I can't put the code inside of the component.  Hope that answers your question


To me, it look like you are trying to access a web service, so instead of using HTTP service, you need to use web service request.
something like this
[HTML]<?xm l version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768" xmlns:employeesservice="services.employeesservice.*" xmlns:valueObjects="valueObjects.*">

    <fx:Declarations>
        <s:WebService
            id="RestaurantSvc"
        wsdl="http://examples.adobe.com/flex3app/restaurant_ws/RestaurantWS.xml?wsdl" />
        <s:CallResponder id="getRestaurantsResult"
            result="restaurants = getRestaurantsResult.lastResult as Restaurant"/>
    </fx:Declarations>

    <fx:Script>
        <![CDATA[
            import mx.controls.Alert;

            protected function b1_clickHandler(event:MouseEvent):void {
                getRestaurantsResult.token = RestaurantWS.getRestaurantss();
            }
        ]]>
    </fx:Script>
. . .
    <s:Button id="b1" label="GetRestaurants" click="button_clickHandler(event)"/> [/HTML]

I hope it will work.

Thanks
Zahid
0 Kudos
NasifAlshaier
Deactivated User
Hi Richard.

were yu able to get the retrieve dat from SQL working?
please advise.
nia@miamidade.gov
0 Kudos