I have an issue with my 'for' loop statement. It is producing duplicate content. My loop statement is as follows:
/* look up top 3 destinations from preferred airport in EU only if preferred continent is EU */
%%[
IF @PreferredContinent_EU == true AND @PreferredDepartureCity_AMS == true then
/* lookup up top 3 from Amsterdam, only if preferred airport is Amsterdam */
set @rows_EU_AMS = LookupOrderedRows("DE_Top_Destinations_City", @rows_to_return, "Rank DESC", "DepartureCity", "Amsterdam")
set @rowcount_EU_AMS = RowCount(@rows_EU_AMS)
/* get city and price in EU city from Amsterdam position number 1 */
for @i = 1 to RowCount(@rows_EU_AMS) do
Set @row1AMSEU = Row(@rows_EU_AMS, @i)
var @destination_eu_city_AMS_1, @destination_eu_price_AMS_1, @destination_eu_url_AMS_1
set @destination_eu_city_AMS_1 = field(@row1AMSEU, "DestinationCity")
set @destination_eu_price_AMS_1 = field(@row1AMSEU, "Price")
set @destination_eu_url_AMS_1 = field(@row1AMSEU, "LandingsURL")]%%
<div> Your flight from Amsterdam to %%=v(@destination_eu_city_AMS_1)=%% %%=v(@destination_eu_price_AMS_1)=%% <a href="%%=v(@destination_eu_url_AMS_1)=%%">checkout here</a>
%%[NEXT @i]%%
%%[for @i = 2 to RowCount(@rows_EU_AMS) do
Set @row2AMSEU = Row(@rows_EU_AMS, @i)
var @destination_eu_city_AMS_2, @destination_eu_price_AMS_2, @destination_eu_url_AMS_2
set @destination_eu_city_AMS_2 = field(@row2AMSEU, "DestinationCity")
set @destination_price_AMS_2 = field(@row2AMSEU, "Price")
set @destination_eu_url_AMS_2 = field(@row2AMSEU, "LandingsURL")]%%
%%=v(@destination_eu_city_AMS_2)=%% %%=v(@destination_eu_price_AMS_2)=%% <a href="%%=v(@destination_eu_url_AMS_2)=%%">checkout here</a> <br>
%%[NEXT @i]%%
%%[for @i = 3 to RowCount(@rows_EU_AMS) do
Set @row3AMSEU = Row(@rows_EU_AMS, @i)
var @destination_eu_city_AMS_3, @destination_eu_price_AMS_3, @destination_eu_url_AMS_3
set @destination_eu_city_3 = field(@row3AMSEU, "DestinationCity")
set @destination_eu_price_3 = field(@row3AMSEU, "Price")
set @destination_eu_url_3 = field(@row3AMSEU, "LandingsURL")]%%
%%=v(@destination_eu_city_AMS_3)=%% %%=v(@destination_eu_price_AMS_3)=%% <a href="%%=v(@destination_eu_url_AMS_3)=%%">checkout here</a><br>
%%[NEXT @i]%%
%%[ENDIF]%%
instead of rendering three times Destination city, Price and URL, it shows up six times.
Anyone who could help me out?
Thanks