<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to handle else/if condition in sightly : Bit Urgent in Adobe Experience Manager Questions</title>
    <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/540537#M134241</link>
    <description>&lt;P&gt;Could you please elaborate on your solution? Bit Urgent&lt;/P&gt;</description>
    <pubDate>Thu, 11 Aug 2022 17:22:53 GMT</pubDate>
    <dc:creator>iamshubham</dc:creator>
    <dc:date>2022-08-11T17:22:53Z</dc:date>
    <item>
      <title>How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200126#M75151</link>
      <description>&lt;P&gt;[Thread Edited By Adobe]&lt;/P&gt;
&lt;P&gt;/*Don’t forget to meet and greet your fellow peers virtually by telling them about yourself &lt;A href="https://adobe.ly/3eDnB4v" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go ahead and to it now: &lt;A href="https://adobe.ly/3eDnB4v" target="_blank" rel="noopener"&gt;https://adobe.ly/3eDnB4v&amp;nbsp;&lt;/A&gt;*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actual Post:&lt;/P&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;In my sightly code I have two page properties which I am successfully getting from my Java WCMUse class.&lt;/P&gt;
&lt;P&gt;${bean.getProperty1}&amp;nbsp; and ${&lt;SPAN style="line-height: 20.8px;"&gt;bean.getProperty2}. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I am able to print these values.&lt;/P&gt;
&lt;P&gt;#1] However, inside &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt; tag, I need to have a logic such that it should check if &lt;SPAN style="line-height: 20.8px;"&gt;${bean.getProperty1&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.8px;"&gt;} is available. If yes, print that , else print the second property.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I am trying the below :&lt;/P&gt;
&lt;P&gt;#2] &amp;lt;p class="article-label"&amp;gt;"${bean.&lt;SPAN style="line-height: 20.8px;"&gt;getProperty1&lt;/SPAN&gt;}?&lt;SPAN style="line-height: 20.8px;"&gt;${bean.&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.8px;"&gt;getProperty1&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.8px;"&gt;}&lt;/SPAN&gt;:&lt;SPAN style="line-height: 20.8px;"&gt;${bean.&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.8px;"&gt;getProperty2&lt;/SPAN&gt;&lt;SPAN style="line-height: 20.8px;"&gt;}&lt;/SPAN&gt;"&amp;lt;/p&amp;gt;&lt;/P&gt;
&lt;P&gt;But its not coming up properly on the page. By that I mean say value1 and value2 are corresponding properties and if property1 is present its printing "value1?value1:" on the page, rather than just a single value.&lt;/P&gt;
&lt;P&gt;Any thoughts/pointers on this will be very helpful.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desktop_exl_promo_600x100_weempoweryou.png"&gt;&lt;img src="https://experienceleaguecommunities.adobe.com/t5/image/serverpage/image-id/5992i8106B0EB296023BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="desktop_exl_promo_600x100_weempoweryou.png" alt="desktop_exl_promo_600x100_weempoweryou.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 08:21:49 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200126#M75151</guid>
      <dc:creator>askdctm</dc:creator>
      <dc:date>2020-05-28T08:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200127#M75152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use &lt;STRONG&gt;data-sly-test&lt;/STRONG&gt; to check for existence, which u can also store in a variable as result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Read docs for this:&amp;nbsp;&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://forums.adobe.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FAdobe-Marketing-Cloud%2Fsightly-spec%2Fblob%2Fmaster%2FSPECIFICATION.md%23225-test" rel="nofollow" target="_blank"&gt;https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/master/SPECIFICATION.md#225-test&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2016 16:05:40 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200127#M75152</guid>
      <dc:creator>edubey</dc:creator>
      <dc:date>2016-06-08T16:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200128#M75153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Praveen,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;Somehow, I am not quite getting as to why its giving output as&amp;nbsp;&lt;SPAN style="color: rgb(79, 80, 81); font-family: adobe-clean, &amp;quot;Helvetica Neue&amp;quot;, Arial, sans-serif; font-size: 14px; line-height: normal; background-color: rgb(230, 231, 232);"&gt;&amp;nbsp;"value1?value1:" .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you can provide a snippet, it would be helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2016 16:13:59 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200128#M75153</guid>
      <dc:creator>askdctm</dc:creator>
      <dc:date>2016-06-08T16:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200129#M75154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're printing out the string literals for all the values, without processing&amp;nbsp;them. The three expressions in the ternary operator&amp;nbsp;are being evaluated in isolation from one another. You should move the statements&amp;nbsp;within a singel expression tag&amp;nbsp;(${}).&lt;/P&gt;&lt;PRE class="prettyprint linenums" data-language=""&gt;&amp;lt;p class="article-label"&amp;gt;${'{0}' @format=[bean.getProperty1?bean.getProperty1:bean.getProperty2]}&amp;lt;/p&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2016 16:20:39 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200129#M75154</guid>
      <dc:creator>B_Stockwell</dc:creator>
      <dc:date>2016-06-08T16:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200130#M75155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;IMG src="https://experienceleaguecommunities.adobe.com/etc/designs/adobeforums/images/icons/quote-arrows.png" /&gt;&lt;P class="quote-text" contenteditable="false"&gt;&lt;CODE&gt;&lt;SPAN class="quote-author"&gt;askdctm&lt;/SPAN&gt; wrote...&lt;/CODE&gt;&lt;/P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;P&gt;&lt;CODE&gt;Hi Praveen,&lt;/CODE&gt;&lt;/P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;P&gt;&lt;CODE&gt;Thank you for your reply.&lt;/CODE&gt;&lt;/P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;P&gt;&lt;CODE&gt;Somehow, I am not quite getting as to why its giving output as&amp;nbsp;&lt;SPAN style="color: rgb(79,80,81);font-family: adobe-clean , &amp;quot;Helvetica Neue&amp;quot; , Arial , sans-serif;font-size: 14.0px;line-height: normal;background-color: rgb(230,231,232);"&gt;&amp;nbsp;"value1?value1:" .&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;P&gt;&lt;CODE&gt;If you can provide a snippet, it would be helpful.&lt;/CODE&gt;&lt;/P&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Please have a look at this post:-&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Link:-&amp;nbsp;&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://forums.adobe.com/external-link.jspa?url=http%3A%2F%2Fblogs.adobe.com%2Fexperiencedelivers%2Fexperience-management%2Fsightly-intro-part-1%2F" rel="nofollow" target="_blank"&gt;http://blogs.adobe.com/experiencedelivers/experience-management/sightly-intro-part-1/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;ul data-sly-list.child="${currentPage.listChildren}"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;li class="${ childList.odd ? 'odd' : 'even'}"&amp;gt;${child.title}&amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;/ul&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Link:-&amp;nbsp;&lt;STRONG&gt;&lt;A class="jive-link-external-small" href="https://forums.adobe.com/external-link.jspa?url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F24550498%2Fconditional-attributes-in-sightly-templates-aem-cq" rel="nofollow" target="_blank"&gt;http://stackoverflow.com/questions/24550498/conditional-attributes-in-sightly-templates-aem-cq&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;Ternary conditional operator&lt;/P&gt;&lt;P&gt;&amp;lt;ul data-sly-list="${items}" class="${condition1 ? 'selected' : ''}"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;li class="${condition2 ? 'selected' : ''}"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Lots of other markup here&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;BR /&gt;&amp;lt;/ul&amp;gt;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks and Regards&lt;/P&gt;&lt;P&gt;Kautuk Sahni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2016 10:14:03 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200130#M75155</guid>
      <dc:creator>kautuk_sahni</dc:creator>
      <dc:date>2016-06-09T10:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200131#M75156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Thanks a lot for your reply.&lt;/P&gt;&lt;P&gt;Tried the below :&lt;/P&gt;&lt;P&gt;"${property1 || property2}" and it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jun 2016 17:23:15 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/200131#M75156</guid>
      <dc:creator>askdctm</dc:creator>
      <dc:date>2016-06-09T17:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle else/if condition in sightly : Bit Urgent</title>
      <link>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/540537#M134241</link>
      <description>&lt;P&gt;Could you please elaborate on your solution? Bit Urgent&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 17:22:53 GMT</pubDate>
      <guid>https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-handle-else-if-condition-in-sightly-bit-urgent/m-p/540537#M134241</guid>
      <dc:creator>iamshubham</dc:creator>
      <dc:date>2022-08-11T17:22:53Z</dc:date>
    </item>
  </channel>
</rss>

