Select to view content in your preferred language

Pass URL parameters in sample viewer

7798
49
11-03-2010 08:08 AM
AaronNash
Deactivated User
There was a previous thread on the old forum to pass search parameters into a url string,
http://forums.esri.com/Thread.asp?c=158&f=2421&t=294907&mc=104#msgid925229
I would like to see if anyone has accomplished this for the new viewer. I have a non-spatial flex application that runs a query on a ArcServer service and returns the results into a datagrid, I then have a button that exports the results into a pdf report. I would like to have another function that takes a value from the datagrid, populates it into a URL string that opens a new browser and zooms to that selected feature. 

thanks,
  Aaron
Tags (2)
0 Kudos
49 Replies
AaronNash
Deactivated User
Attached are the modified files, I appreciate you looking at this
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

   In your MapManager:

       if (result["Parcels.DBO.Parcels.MBL"])
        xPPIN = result.Parcels.DBO.Parcels.MBL;


This is suppose to be the name of the parameter that you are passing in from the url (i.e. MBL)

Change these line to:
       if (result["MBL"])
        xPPIN = result.MBL;
0 Kudos
AaronNash
Deactivated User
made the changes, no luck. Same behavior
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

    Do you have the Flash player debuger version? You need to place some break points in your code and debug to see if you get to them.
0 Kudos
AaronNash
Deactivated User
I had to change somethings on my machine, but I have debugger mode set up. Any suggestions on where i should put break points and what I behavior I should be looking for. I have not run in debugger mode
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

Here are some steps to take:

This is the most involved but the correct way to specify url parameter values for your apps launch configuration. There are many steps to do this but if you follow then you will have your development environment step in the best possible way to debug and work with your app and flash builder.
I. Download Flash Player Debug version here http://www.adobe.com/support/flashplayer/downloads.html
If you are using IE then choose (for IE)
If you are using FireFox or any other browser as your default then choose (for Netscape compatible browsers).

II. Configure IIS (Assuming you are not using any other web server) virtual directory for your app
a. In IIS choose new virtual directory name it FlexViewer2.1 and point it's path to your bin-debug folder for your flexviewer project.

III. Right click on your app in the project navigator window and choose properties and then Flex Build Path

IV. In the output folder url type your machine name and the virtual directory name you specified in step II.
V. click Run/Debug Settings (back on the left).
VII. choose your app which is likely to be the only thing in that window and then edit
VIII. look towards the bottom of this dialog and un-check use default
IX. add ?MBL=xxxxxxxxx

then I would start by adding a break point in the map manager right under this line
if (xPPIN != ""){
and what you are looking for is when you reach the breakpoint (if you do) does xPPIN have the value that you passed into the URL? From there I would put a breakpoint in the utimerComplete function (first line of that function) and step through the code to see if the id variable is not NaN.
0 Kudos
AaronNash
Deactivated User
I think I am doing this correctly, I have everything running on my local machine in debug mode in IIS. I added the specified break points and stepped through them, I attached 2 screen shots. At  
if (xPPIN != ""){ 
xPPIN did have a value, I Stepped past that, it went through the event listener and started the timer. Went to
if (!xExt == "")
and then jumped to the bottom of the function
catch (error:Error){}
. At the second break point, function utimerComplete, the id variable was NaN. BTW thanks for all your help
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

  once you step past your second breakpoint is the id still NaN? If so in your config.xml is your searchwidgets label "Search"?
0 Kudos
AaronNash
Deactivated User
I have made some progress, It does figure out and populate the id as 8, which is correct. I have followed the process into the search widget's queryPPIN function, it brings over the xPPIN value. When I step forward it jumps to the function onResult totally missing the query.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Aaron,

   You need to place a breakpoint in the queryPPIN function so you can see what the
query.where = expr;
where is equal to.
0 Kudos