Select to view content in your preferred language

SFV 1.3 Pass URL to Search parcels

4354
18
05-06-2010 07:59 AM
LeeAllen
Frequent Contributor
I would like to pass a URL string from our property search page like http://...PRCL_ID=1420303004021000 to the flex app search so that when users click on a link on the property search page, this ID is sent to the app and zooms to the parcel automatically. Is this possible?

I have the search widget setup to search ID's when typed in.

http://gis.snco.us/gisviewer

Lee
Tags (2)
0 Kudos
18 Replies
RobertScheitlin__GISP
MVP Emeritus
Lee,

    It is not simple as pie but here is the link to accomplish just that.

http://forums.esri.com/thread.asp?c=158&f=2421&t=266031&mc=47
0 Kudos
CoryHines
Deactivated User
Hi Lee,

Take a look at this forum as well.  If I'm understanding what you're looking for correctly we have this working on our site.  The forum is quite long, but sprinkled throughout it are all the steps you'll need.

http://forums.esri.com/Thread.asp?c=158&f=2421&t=294907&mc=104

http://gis.linncounty.org/maps/index.html?parcelnum=133647600700000

Cory
0 Kudos
LeeAllen
Frequent Contributor
I have followed all of the steps in forum, I think I'm close.  After compiling, I get an error in my SiteContainer.mxml (Description Resource Path Location Type
1021: Duplicate function definition. SiteContainer.mxml /Flexviewer1.3/src/com/esri/solutions/flexviewer line 176 Flex Problem)



here is the code in the .mxml file:



public function init():void
   {
    _container = this;
    _lock = true; //make sure only one container is created.
   
    initLogging();
   
    //make sure the event bus is ready.
    _containerEventDispatcher = EventBus.getInstance();
   
    //prepare to show error message
    SiteContainer.addEventListener(AppEvent.APP_ERROR, showError);
   
    //listen for the config data to be loaded
    SiteContainer.addEventListener(AppEvent.CONFIG_LOADED, config);
   
    //tell the modules it's on business.
    SiteContainer.dispatch(SiteContainer.CONTAINER_INITIALIZED);
   }


I can post all of .mxml files if necessary.

Thanks for any help!

Lee
0 Kudos
CoryHines
Deactivated User
Hi Lee,

I don't know if this matter or not, but there are a couple of spaces in the code that may have just been how they were copied into the forums.

//listen for the config data to be loaded
SiteContainer.addEventListener(AppEvent.CONFIG_[LOA DED, config);

//tell the modules it's on business.
SiteContainer.dispatch(SiteContainer.CONTAINER_INI TIALIZED);

If that's not in your actual code could you post your entire SiteContainer and I'll take a look at it.

Cory
0 Kudos
LeeAllen
Frequent Contributor
Here is the site container and the mapmanager(just in case you need to take a peek at it) mxml files.  Thanks for taking a look.  Lee
0 Kudos
CoryHines
Deactivated User
Hi Lee,

See if this SiteContainer works.  I noticed a couple of lines of code that were missing.  Hopefully this is all that's missing.

I didn't check the MapManager, but if this doesn't work I'll take a look at that too.

Cory
0 Kudos
LeeAllen
Frequent Contributor
Cory,

I can't get the code to come through with that file (saved and renamed without .zip), could you try again or put code in reply for me to copy?

Thanks!
0 Kudos
CoryHines
Deactivated User
Hope this helps.

<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright © 2008 - 2009 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions.  See use restrictions in the file:
// <install location>/FlexViewer/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<mx:Canvas xmlns:mx    ="http://www.adobe.com/2006/mxml"
   xmlns:comp    ="components.*"
   width     ="100%"
   height     ="100%"
   horizontalScrollPolicy ="off"
   verticalScrollPolicy ="off"
   creationComplete  ="init()" >

    <mx:Script>
  <![CDATA[

   import com.esri.solutions.flexviewer.AppEvent;
   import com.esri.solutions.flexviewer.components.ErrorWindow;  
   import mx.containers.TitleWindow;
   import mx.logging.Log;
      import mx.logging.LogEventLevel;
      import mx.logging.targets.TraceTarget;
   import mx.managers.PopUpManager;
 
      public static const NAVIGATION_ZOOM_FULL:String   = "zoomfull";
     
      public static const NAVIGATION_ZOOM_PREVIOUS:String  = "zoomprevious";
     
      public static const NAVIGATION_ZOOM_NEXT:String      = "zoomnext";
     
   public var configManager:ConfigManager;
  
   public var uiManager:UIManager;
  
   public var controller:Controller;
  
   public var mapManager:MapManagercopy;
  
   public var widgetManager:WidgetManagerDocked;
  
   public var dataManager:DataManager;
  
   private static var _container:SiteContainer;
  
   private static var _lock:Boolean = false;
  
   private var _containerEventDispatcher:EventBus;
  
   public static var CONTAINER_INITIALIZED:String = "containerInitilized";

   private var configData:ConfigData;
  
   public function init():void
   {
    _container = this;
    _lock = true; //make sure only one container is created.
   
    initLogging();
   
    //make sure the event bus is ready.
    _containerEventDispatcher = EventBus.getInstance();
   
    //prepare to show error message
    SiteContainer.addEventListener(AppEvent.APP_ERROR, showError);

    SiteContainer.addEventListener(AppEvent.CONFIG_LOADED, config);
   
    //tell the modules it's on business.
    SiteContainer.dispatch(SiteContainer.CONTAINER_INITIALIZED);
   }

   private function config(event:AppEvent):void
      {    
       configData = event.data as ConfigData;
      }
      
   public function getWidgetId(widgetLabel:String):Number
   {
    var id:Number;
    for (var i:Number = 0; i < configData.configWidgets.length; i++)
          {
           if (configData.configWidgets.label == widgetLabel)
            id = configData.configWidgets.id;
          }
          return id;
   }

            /**
             * Initialize the logging. As an example, the logging is setup to only
             * log the fatal event during the RPC related network communication,
             * such as HTTP call to obtain configuration file.
             */

            private function initLogging():void {
                // Create a target.
                var logTarget:TraceTarget = new TraceTarget();
    
                // Log only messages for the classes in the mx.rpc.* and
                // mx.messaging packages.
                logTarget.filters=["mx.rpc.*","mx.messaging.*"];
   
                // Log on fatal levels.
                logTarget.level = LogEventLevel.FATAL;
   
                // Add date, time, category, and log level to the output.
                logTarget.includeDate       = true;
                logTarget.includeTime       = true;
                logTarget.includeCategory   = true;
                logTarget.includeLevel      = true;
   
                // Begin logging.
                Log.addTarget(logTarget);
            }        
 
      //to make sure the the children are visible.
      private var isAddChild:Boolean = true;
      protected override function commitProperties():void
      {
          super.commitProperties();
         
          if (isAddChild)
          {
           addChild(mapManager);
           addChild(controller);
           addChild(widgetManager);
           isAddChild = false;
          }   
      }
     
      private function showError(event:AppEvent):void
      {
             var errorWindow:ErrorWindow = ErrorWindow(PopUpManager.createPopUp(this, ErrorWindow, true));
           
             // Add title to the title bar.
             errorWindow.errorMessage = event.data as String;
             
             // Add a close button.
             // To close the container, your must also handle the close event.
             errorWindow.showCloseButton=true;
      
      }
     
     /* -----------------------------------------------
        static functions as proxy of Event Bus
        ----------------------------------------------- */
       
   public static function getInstance():SiteContainer
   {
    if (!_lock){
     _container = new SiteContainer();
     _lock = true;
    }
    return _container; 
   }
 
      //the following are the methods to allow modules access event bus via the contains.
   public static function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
      {
       EventBus.getInstance().addEventListener(type, listener, useCapture, priority, useWeakReference);
      }     
     
      public static function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
      {
       EventBus.getInstance().removeEventListener(type, listener, useCapture);
      }     
     
      //this is the simplest way of communicate. Just use a string.
      public static function dispatch(type:String):Boolean
      {
       return EventBus.getInstance().dispatch(type);
      }     
     
      public static function dispatchEvent(event:Event):Boolean
      {
       var eventBase:EventBus = EventBus.getInstance();
          return eventBase.dispatchEvent(event);
      }     
     
      /**
      *
      */
      public static function setStatus(status:String):void
      {
       dispatchEvent(new  AppEvent(AppEvent.SET_STATUS, false, false, status));
      }
   private var configData:ConfigData;
  
   public function init():void
   {
    _container = this;
    _lock = true; //make sure only one container is created.
   
    initLogging();
   
    //make sure the event bus is ready.
    _containerEventDispatcher = EventBus.getInstance();
   
    //prepare to show error message
    SiteContainer.addEventListener(AppEvent.APP_ERROR, showError);
   
    //listen for the config data to be loaded
    SiteContainer.addEventListener(AppEvent.CONFIG_LOADED, config);
   
    //tell the modules it's on business.
    SiteContainer.dispatch(SiteContainer.CONTAINER_INITIALIZED);
   }
  
   public function getWidgetId(widgetLabel:String):Number
   {
    var id:Number;
    for (var i:Number = 0; i < configData.configWidgets.length; i++)
    {
     if (configData.configWidgets.label == widgetLabel)
      id = configData.configWidgets.id;
    }
    return id;
   }
   //Add this to the sitecontainer
   private function config(event:AppEvent):void
   {    
    configData = event.data as ConfigData;
   }

  ]]>
    </mx:Script>

    <mx:Metadata>
     [DefaultProperty("childen")]
    </mx:Metadata>
   
</mx:Canvas>
0 Kudos
LeeAllen
Frequent Contributor
Cory, thanks.  I got everything to compile with no errors, but like many before me, nothing happens when the site runs.  I looked at it in firebug, and it is not getting the GET query.  The site is http://gis.snco.us/gisviewer.  The test URL would be http://gis.snco.us/gisviewer/index.html?PRCL_ID=133647600700000. I have attached the SiteContainer.mxml, MapManager, and Search.mxml. 

Thanks for any help!!!

Cheers and happy holidays, I''m out for the weekend.
0 Kudos