AnsweredAssumed Answered

How to make attributes without values not to be shown?

Question asked by NedimNasic on Jan 20, 2016
Latest reply on Jan 21, 2016 by NedimNasic



I´m going to explain question a bit further.


I made a side bar where I´m showing all my content from pop up (which is turned off). We chose few of attributes we want to show within the sidebar, but the problem is that not all features have values under all those attributes, so now they are just shown as empty.


Bigger problem are the links, since we have 2 attributes showing links to external documents (with clickable text "More info").

Now, no matter if there is a link in the table for that feature or not, both link attributes are shown, both with clickable text, from which only one is right or none (as some don´t have any external links).


I would like a solution where I can write in the code, if attribute is without value not to be shown, those ones with values to be shown. I´ve tried with different combinations of IF ELSE, but didn´t work, I just lack experience.

Here´s the part of the code with attributes in JS:


var other = new InfoTemplate("",
  " <b>Name</b>:<br> ${Name}" + "<br>" + "<br>" +
  "&nbsp<b>Map layer</b>:<br> ${Map_layer}"+ "<br>" + "<br>" +
  "&nbsp<b>Classification</b>:<br> ${Classification}"+ "<br>" + "<br>" +
  "&nbsp<b>Assesment</b>:<br> ${Assesment}" + "<br>" + "<br>" +
  " <b>Justification</b>:<br> ${Justification}" + "<br>" + "<br>" +
  " <b>Link</b>:<br> <a href=${Link} target=_blank>More info</a>" + "<br>" + "<br>" +
  " <b>Link2</b>:<br> <a href=${Link2} target=_blank>More info</a>" + "<br>" + "<br>" +
  "&nbsp<b>Contact person</b>:<br> ${Contact_person}"



Help is much appreciated! Thanks!