Is there a break function in AMPScript? I have following code snippet and would like to end the 'For' loop if the condition is met. Currently the code will transverse the whole DE.
How can I fix this?
%%[ set @DELookup = lookuprows('DE', 'SubscriberKey', SubscriberKey)
if rowcount(@DELookup) >= 1 then
for @i = 1 to rowcount(@DELookup) do
set @instanceRow = row(@DELookup, @i)
set @ID = field(@instanceRow, 'columnID')
if not empty(@ID)then
// DO something
]%%
%%[else]%% %%[endif]%%
%%[next @i]%% %%[else]%% %%[endif]%%
]%%
Best Answer
Here is a very simple trick to brack the For Loop -