1

If a text property exists, I want to display an attribution link; if it is empty or undefined, display nothing.

     if (relatedurl)
         {section {
          content {
            attribution-link {
              label {
                 template ("Related content: ")
                    }
                url ("#{value(this.relatedurl)}")
}
          }
        }

This is displaying as empty while the same code without the if is displaying the attribution link properly.How do I formulate the test?

Tek Nath Acharya
  • 1,676
  • 2
  • 20
  • 35
Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29

1 Answers1

5
   if (exists(this.relatedurl))
    {
       section {
      content {
        attribution-link {
          label {
             template ("Related content: ")
                }
            url ("#{value(this.relatedurl)}")=}
      }
    }
     }
     // if no relatedurl, don't print anything

per https://bixbydevelopers.com/dev/docs/dev-guide/developers/customizing-plan.using-el

Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29