0

I'm trying to remove the border only for the last time [content] shows up in a loop. A user can have anywhere from 1 to 3 rows showing. How would I set a conditional statement just for the last occurrence in an AMPScript loop?

%%[
var @rs, @row, @cntr, @link
SET @rs = LookupRows("S1", "S2", S3)

for @cntr = 1 to ROWCOUNT(@rs) do
    SET @row = Row(@rs, @cntr)
]%%

    **[content]**

    %%[IF  ROWCOUNT(@rs) == 0  then]%%

    %%[ENDIF]%%  

%%[next @cntr]%%

1 Answer 1

1

I think you're on the right track. Something like this, perhaps?

%%[

var @rs, @row, @cntr, @link
SET @rs = LookupRows("S1", "S2", S3)

for @cntr = 1 to ROWCOUNT(@rs) do

    SET @row = Row(@rs, @cntr)

]%%

    %%[ IF @cntr < ROWCOUNT(@rs) then ]%%

        [content]   

    %%[ ELSE ]%%

        [content displayed on last iteration]

    %%[ ENDIF ]%%  

%%[ next @cntr ]%%
0

You must log in to answer this question.

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