Condition When Hyperlink File Does Not Exist for Feature in WebApp

3835
2
05-12-2015 12:03 PM
MichaelVolz
Esteemed Contributor

In a FlexViewer app I currently have a hyperlink to a file with an Identify pop-up window. This link works for every feature in a mapservice because each feature has an associated file.  Now I have another feature that only has links for certain features.  If the enduser would click on a feature without an associated link I get a 404 - File or directory not found error.  Do the Identify popups allow conditional statements in the xml file that would test for the existence of a linked file so the user could be informed in a more user friendly way that there is no associated feature for the selected feature?

Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Michael,

   Sure I think the answer to this question is in this thread:  Popup 3.0 - hide field if value=null

RhettZufelt
MVP Frequent Contributor

Of course, this means changing the source and re-compiling.  If you have this ability, this is one way I have handled that in the past.

Assuming my hyperlinks are to a photo and works great if there is a valid filename in there.  However, if there is no value in there, would throw an error, so in my popuprendererskin, I have added something similar to:

        if (fieldInfo.fieldName == "PHOTO"){
          if(formattedAttributes[fieldInfo.fieldName] == " "){
           formattedAttributes[fieldInfo.fieldName] = "PlaceHolderFilename.jpg";
          }

This way, if the field is "PHOTO" and the value is blank/null, it will replace the value with "PlaceHolderFilename.jpg".  then, in the folder with the other images, there is a jpeg named PlaceHolderFilename.jpg which says "No Photo Available".

So, if it has a valid link, the popup will show it, if not, will show a link to this "No Photo Available" document.

R_