0

im trying to fix this this ampscript error. I get a message saying

Error An IF statement is not closed with the required ENDIF statement.

Can anyone take a look at this script to see what i'm might be missing? (edited to show the remaining code)

%%[
set @rows = LookupOrderedRows("Consult_Notifications_Daily_followedreply",3,"date desc","EmailAddress",emailaddr)
set @rowCount = rowcount(@rows)
if @rowcount > 1 then
    set @row = row(@rows,@i)
    set @followedReplyNotificationType = field(@row,"NotificationType")
    set @followedReplyPostName = field(@row,"Postname_1")
    set @followedReplyTargetURL = field(@row,"targeturl_1")
    set @followedReplyRecipientName = field(@row,"RecipientNameDeg")
    set @followedReplyMentionedUser = field(@row,"MENTIONEDUSER")
    set @followedReplyActorName = field(@row,"ActorNameDeg")
    set @followedReplyUser = field(@row,"User")
    set @followedReplyPostTitle = field(@row,"PostTitle_1")
    set @followedReplyUserAccountUrl = field(@row,"UserAccountUrl")
    set @followedReplyActorAccountUrl = field(@row,"ActorAccountUrl_1")
    set @followedReplyThreadUrl = field(@row,"ThreadUrl_1")
    set @followedReplyDate = field(@row,"Date")
    set @followedReplyPostBody = field(@row,"PostBody_1")



endif 

 if @followedReplyNotificationType == 'FollowedReply' then

]%%

    -->
    <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(@followedReplyActorAccountUrl)=%%" target="_blank" style="font-size: 14px;font-family: 'Proxima Nova','Helvetica',Arial,sans-serif; font-weight: normal; text-decoration: none; color: #007cb0;">%%=v(@followedReplyRecipientName)=%%</a> responded to your post on %%=v(@followedReplyDate)=%%.
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>

    <!-- 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>

6

You probably have bits of html after your initial ampscript block, and you need to check further down the code, if a closing ENDIF exists. Hence you code should be something along these lines:

%%[
set @rows = LookupOrderedRows("Consult_Notifications_Daily_followedreply",3,"date desc","EmailAddress",emailaddr)
...
 if @followedReplyNotificationType == 'FollowedReply' then
]%%

<p>Hello world</p>

%%[
endif
]%%

This is this final ENDIF I suspect is missing altogether.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.