Select to view content in your preferred language

Identify Widget for FlexViewer 2.1

60429
266
09-23-2010 11:34 AM
RobertScheitlin__GISP
MVP Emeritus
All,

   I have been waiting for the Final release of the FlexViewer 2.1 before I started to push out some widgets I have been working on.

Here is my Identify Widget for Flex Viewer 2.1. I have tested to ensure proper functioning with FlexViewer 2.1 and am now releasing it to you since the API Team did not get one into the FlexViewer.

Here is the link:

http://www.arcgis.com/home/item.html?id=39cf66d58c234279ba728c50461a1a89

More FlexViewer 2.1 widgets to come stay tuned...
Tags (2)
0 Kudos
266 Replies
JonFisher
Emerging Contributor
I cant seem to get to the fields in my joined (or related) table to show up.  Not sure I have the syntax correct. 

Do you have to have two layer blocks, one for the master layer and one for the joined layer?

No, just use the alias as listed on the REST page. For example, looking at http://maps.tnc.org/ecadpubprod-anon/rest/services/conservation_projects_anon_WM/MapServer/1 I use the following xml (which works):
  <layer>
   <name>Conservation Project Polygons</name>
   <fields>Project Name,Contact First Name,Public?,Project Organization,Contact Organization,ConPro URL</fields>
   <linkfield>ConPro URL</linkfield>
   <linkprefix></linkprefix>
   <linksuffix></linksuffix>
   <iconfield></iconfield>
   <iconprefix></iconprefix>
   <iconsuffix></iconsuffix>
   <zoomscale>1155581.108577</zoomscale>
   <forcescale>true</forcescale>
  </layer>


Or do you need to qualify the field names with which table they are coming from. (Doesnt look like you did this, but it would make sense if you needed to.)


You DO need to do this in widgets where a field name (rather than alias) is required. So, for example, my search widget configuration for the same layer is quite different:
  <layer>
   <name>Conservation Projects</name>
   <url>http://maps.tnc.org/ecadpubprod-anon/rest/services/conservation_projects_anon/MapServer/1</url>
   <expression>lower(CP_STEWARD.PROJECTS.PROJECT_NAME) LIKE lower('%[value]%')</expression>
   <textsearchlabel>Find TNC Conservation Projects by Name:</textsearchlabel>
   <graphicalsearchlabel>Find details about conservation projects by clicking on one of the tools below, then clicking on the site you want to find out more about (read the help for details).</graphicalsearchlabel>
   <fields all="false">
    <field name="CP_STEWARD.PROJECTS.PROJECT_NAME"/>
    <field name="CP_STEWARD.PROJECTS.PROJECTORG"/>
    <field name="CP_STEWARD.PROJECTS.CONTACTORG"/>
    <field name="CP_STEWARD.PROJECTS.CONPRO_URL"/>
   </fields>
   <titlefield>CP_STEWARD.PROJECTS.PROJECT_NAME</titlefield>
   <linkfield>CP_STEWARD.PROJECTS.CONPRO_URL</linkfield>
  </layer>


Just to be clear, the "_" in the field name only seem to be a problem with the alias and link field.  if you just have an alias field with an "_" in it and you want to simply display it, then it works fine.
Stephen


I discovered (and reported) that there is a bug in the QueryWidget where fields with a name that ends with "_" are not being treated correctly. So there may be some problem with underscores in some of the underlying ESRI code.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Stephen,

    If you are trying to display fields that are from a join than yes you have to use the full join field name. I have not had any time to look into the _ issue so any info you guys give me on what is and is not working would be helpful.
0 Kudos
DavidAllen
Frequent Contributor
David,

   that is what I was afraid of... The info popup that you want to have the alias for is not part of the identifyWidget code it is part of the FlexViewer base code.



Hey - that's cool. I cover that in my instructions, so users should figure out what to do.
0 Kudos
JonFisher
Emerging Contributor
I noticed today that the identify widget displays the hyperlink icon for all records of any layer that has a linkfield specified, even if the particular record's linkfield is null. Ideally I'd like it to work like the basic searchwidget: if the linkfield is null the link icon should not appear and clicking the link shouldn't open a blank web page, if the linkfield has an actual value, the icon should be visible and clicking the link should open that link.

Is this an easy change to make? I was guessing perhaps line 506:
if(link!="")
only looks for empty strings instead of nulls? So I just need to make sure that the link isn't an empty string AND is not null?

Thanks for any thoughts. I'm using the latest version of the widget (2.2.1 from 12/17).
0 Kudos
GeorgiannaStrode
Deactivated User
Jon,

We had the same issue -- apparently we have some spaces in our data.

We solved it by using:

if (link.charAt(0)!=" ") 

Hope this helps.
0 Kudos
GeorgiannaStrode
Deactivated User
I have 2 questions on the Identify viewer:

1. I'd like to show some layers even if they are not turned on (Section-Township-Range).  I have edited the xml to change 'visible' to other options with no success.  I've also edited the mxml code to comment out the test for visibility but that didn't work either.

2.  How to suppress the message "Identify operation not allowed on this layer"

Thanks in advance!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Georgianna,

   1. have you set the onlythese="false"

   2. Here is the code to be changed:

   //on fault
   private function onFault(event:FaultEvent):void
   {
    if(event.fault.faultDetail != "Identify operation not supported on this service")             
     showMessage(event.fault.faultDetail, false);         
   }
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jon,

   I am working on that issue right now. I am thinking it is because you are using a prefix and/or suffix the link is never and empty string so you always get the link whether it is null or not. Can you verify for me that some of your fields that the link is set to do actually display with a null in them when you are looking at them in ArcMap?
0 Kudos
GeorgiannaStrode
Deactivated User
Georgianna,

   1. have you set the onlythese="false"

   2. Here is the code to be changed:

   //on fault
   private function onFault(event:FaultEvent):void
   {
    if(event.fault.faultDetail != "Identify operation not supported on this service")             
     showMessage(event.fault.faultDetail, false);         
   }




Robert thanks once again!
0 Kudos
JonFisher
Emerging Contributor
Jon,

   I am working on that issue right now. I am thinking it is because you are using a prefix and/or suffix the link is never and empty string so you always get the link whether it is null or not. Can you verify for me that some of your fields that the link is set to do actually display with a null in them when you are looking at them in ArcMap?


I have <linkprefix> and <linksuffix> empty (xml is below). I'm attaching a picture of how it looks in the flex viewer for one of the null records, as well as how it looks in the source mxd (also null). Check out the last layer (Marine ERA) which has the most null values for era_rept. Thanks!


EDIT: I remove the extraneous portion of the xml for readability
<?xml version="1.0" ?>
 <layers onlythese="true">
  <layer>
   <name>Marine ERAs</name>
   <fields>EAA_MARINE,MARINE_STA,ERA_REPT</fields>
   <linkfield>ERA_REPT</linkfield>
   <linkprefix></linkprefix>
   <linksuffix></linksuffix>
   <iconfield></iconfield>
   <iconprefix></iconprefix>
   <iconsuffix></iconsuffix>
   <zoomscale>9244648.8686180003</zoomscale>
   <forcescale>true</forcescale>
  </layer>
 </layers>
0 Kudos