0

In my code I have 3 block sections. Each with replies. The way it works the data extension gets checked to see if there's content. If no content then nothing displays. But the block isn't collapsing. I think there might be a problem with the if not empty parameter. The content is correctly not displaying but the block it self still displays when it shouldn't. I added a screenshot of the test preview. https://i.sstatic.net/wH6XP.jpg


Set @rows = Rowcount(LookupOrderedRows("Consult_Notifications_Daily_Digest",3,"date desc","EmailAddress",emailaddr))

IF @Rowcount > 0 then
set @rows = LookupOrderedRows("Consult_Notifications_Daily_Digest",3,"date desc","EmailAddress",emailaddr)

SET @RowTarget = Row(@rows,1)
    set @followedReplyRecipientName = field(@RowTarget,"RecipientName")
    set @followedReplyPostName = field(@RowTarget,"PostName")
    set @followedReplyPostBody = field(@RowTarget,"PostBody_1")
    set @followedReplyTargetURL = field(@RowTarget,"TargetUrl_1")
    set @followedReplyActorAccountUrl = field(@RowTarget,"ActorAccountUrl_1")

    set @followedReplyPostName2 = field(@RowTarget,"PostName_2")
    set @followedReplyPostBody2 = field(@RowTarget,"PostBody_2")
    set @followedReplyTargetURL2 = field(@RowTarget,"targeturl_2")
    set @followedReplyActorAccountUrl2 = field(@RowTarget,"ActorAccountUrl_2")


    set @followedReplyPostTitle = field(@RowTarget,"PostTitle_1")
    set @followedReplyUserAccountUrl = field(@RowTarget,"UserAccountUrl")

    set @followedReplyThreadUrl = field(@RowTarget,"ThreadUrl_1")
    set @followedReplyDate = field(@RowTarget,"Date")

    set @followedReplyMentionedUser = field(@RowTarget,"MENTIONEDUSER")


    set @followedReplyPostTitle_2 = field(@RowTarget,"PostTitle_2")
    set @followedReplyThreadUrl_2 = field(@RowTarget,"ThreadUrl_2")

        set @followedReplyPostTitle_3 = field(@RowTarget,"PostTitle_3")
    set @followedReplyThreadUrl_3 = field(@RowTarget,"ThreadUrl_3")
set @followedReplyPostName3 = field(@RowTarget,"PostName_3")
    set @followedReplyPostBody3 = field(@RowTarget,"PostBody_3")
    set @followedReplyTargetURL3 = field(@RowTarget,"targeturl_3")
    set @followedReplyActorAccountUrl3 = field(@RowTarget,"ActorAccountUrl_3")

    set @followedReplyActorName = field(@RowTarget,"ActorNameDeg")

      SET @PostActor = [ActorNameDeg]
SET @PostActorURL = field(@RowTarget,"ActorAccountUrl_1")

IF not empty(@PostName) then ]%% 
%%[ENDIF]%%
-->



        <tr>
          <td style="padding: 7px 0 0 0;">
            <table width="560" cellpadding="0" cellspacing="0" borde="0" class="container">
              <tr>
                <td align="center" valign="middle" style="padding:2px 2px 3px 1px; box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.09);" bgcolor="#dfdfdf">
                  <table width="558" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                    <tr>
                      <td style="padding:20px 20px 20px 20px; font-size: 14px;" align="left">
                        <table width="508" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                          <tr>
                            <td width="508" style="padding: 0 0px 0 0;" class="container" colspan="1" valign="top">
                              <table width="508" class="container" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td align="left" style="font-size: 18px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">
                                    <a href="%%=redirectTo(@followedReplyTargetURL)=%%" style="font-size: 18px;color: #000000;text-decoration:none;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">%%=v(@followedReplyPostName)=%%</a>
                                  </td>
                                </tr>
                                %%[if not empty(@followedReplyPostBody) then]%%
                                <tr>
                                  <td align="left" style="font-size: 14px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal; color: #606060;">
                                    %%=v(@followedReplyPostBody)=%% .. 
                                    <a href="%%=redirectTo(@followedReplyTargetURL)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">read more</a>
                                  </td>
                                </tr>
                                %%[endif]%%
                                <tr>
                                  <td align="left" style="padding: 0px 0 0px 0; font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; color: #3a3b3c;">
                                   <a href="%%=RedirectTo(@PostActorURL)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">%%=v(@PostActor)=%%</a> responded to your post.
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>

 <!--

%%[
IF not empty(@PostName_2) then

]%%
%%[ENDIF]%%

-->

        <tr>
          <td style="padding: 7px 0 0 0;">
            <table width="560" cellpadding="0" cellspacing="0" borde="0" class="container">
              <tr>
                <td align="center" valign="middle" style="padding:2px 2px 3px 1px; box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.09);" bgcolor="#dfdfdf">
                  <table width="558" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                    <tr>
                      <td style="padding:20px 20px 20px 20px; font-size: 14px;" align="left">
                        <table width="508" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                          <tr>
                            <td width="508" style="padding: 0 0px 0 0;" class="container" colspan="1" valign="top">
                              <table width="508" class="container" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td align="left" style="font-size: 18px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">
                                    <a href="%%=redirectTo(@followedReplyTargetURL2)=%%" style="font-size: 18px;color: #000000;text-decoration:none;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">%%=v(@followedReplyPostName2)=%%</a>
                                  </td>
                                </tr>
                                %%[if not empty(@followedReplyPostBody2) then]%%
                                <tr>
                                  <td align="left" style="font-size: 14px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal; color: #606060;">
                                    %%=v(@followedReplyPostBody2)=%% .. 
                                    <a href="%%=redirectTo(@followedReplyTargetURL2)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">read more</a>
                                  </td>
                                </tr>
                                %%[endif]%%
                                <tr>
                                  <td align="left" style="padding: 0px 0 0px 0; font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; color: #3a3b3c;">
                                    <a href="%%=RedirectTo(@PostActorURL)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">%%=v(@PostActor)=%%</a> responded to your post.
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>

          <!--%%[endif]%%-->
   <!--

%%[
IF not empty(@PostName_3) then

]%%
%%[ENDIF]%%
-->

            <tr>
          <td style="padding: 7px 0 0 0;">
            <table width="560" cellpadding="0" cellspacing="0" borde="0" class="container">
              <tr>
                <td align="center" valign="middle" style="padding:2px 2px 3px 1px; box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.09);" bgcolor="#dfdfdf">
                  <table width="558" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                    <tr>
                      <td style="padding:20px 20px 20px 20px; font-size: 14px;" align="left">
                        <table width="508" class="container" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
                          <tr>
                            <td width="508" style="padding: 0 0px 0 0;" class="container" colspan="1" valign="top">
                              <table width="508" class="container" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td align="left" style="font-size: 18px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">
                                    <a href="%%=redirectTo(@followedReplyTargetURL3)=%%" style="font-size: 18px;color: #000000;text-decoration:none;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal;">%%=v(@followedReplyPostName3)=%%</a>
                                  </td>
                                </tr>
                                %%[if not empty(@followedReplyPostBody3) then]%%
                                <tr>
                                  <td align="left" style="font-size: 14px;font-family: 'Roboto Condensed','Helvetica',Arial,sans-serif; font-weight: none; padding:0 0 10px 0; line-height: normal; color: #606060;">
                                    %%=v(@followedReplyPostBody3)=%% .. 
                                    <a href="%%=redirectTo(@followedReplyTargetURL3)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">read more</a>
                                  </td>
                                </tr>
                                %%[endif]%%
                                <tr>
                                  <td align="left" style="padding: 0px 0 0px 0; font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; color: #3a3b3c;">
                               <a href="%%=RedirectTo(@PostActorURL)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">%%=v(@PostActor)=%%</a> responded to your post.
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <!--%%[endif]%% -->
        <!-- End Content -->
        <tr>
          <td align="center" class="mobile-pad-top-20" style="padding: 22px 0 0 0; font-size: 16px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: none; color: #3a3b3c; line-height: normal;">
            <a href="%%=redirectTo(@followedReplyUserAccountUrl)=%%" target="_blank" style="font-size: 16px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">
              See all your posts
            </a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>


  [1]: https://i.sstatic.net/rKdLh.jpg

1 Answer 1

5

The problem is, that you are directly closing the IF-block after you open it. Therefore it doesn't have any effect.

You currently have the following:

%%[
IF not empty(@PostName_2) then

]%%
%%[ENDIF]%%
[YOUR CONDITIONAL HTML CODE]

Instead you should close the IF using the ENDIF-keyword after your conditional html code:

%%[
IF not empty(@PostName_2) then

]%%
[YOUR CONDITIONAL HTML CODE] 
%%[ENDIF]%%

This is the case for every of those blocks you use.

If you have many nested if-clauses the endif always closes the previous one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .