Skip to main content
1 of 2
Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88

First, you'll need to add a field in your Data Extension that has a static value (e.g. LookupKey, with a default value of 1). You can only do a lookup with an equals operator. Then you'll need to set it for your existing rows -- probably easiest with an export and overwrite import.

Once that's done, then you can use that LookupKey value in your lookup...something like this:

%%[

var @i, @cities, @row, @rowCount, @maxRows
var @City, @prevCity, @Area, @Salon, @Number

set @maxRows = 0 /* up to 2000 */

set @cities = LookupOrderedRows("Cities" ,@maxRows, "Number asc", "lookupKey","1")
set @rowCount = RowCount(@cities)
set @prevCity = ""

for @i = 1 to @rowCount do

  set @row = Row(@cities,@i)
  set @City = Field(@row, "City")
  set @Area = Field(@row, "Area")
  set @Salon = Field(@row, "Salon")
  set @Number = Field(@row, "Number")

  if @rowCount == 1 then

    write(concat("<ul>"))

  endif 

  if empty(@prevCity) or @City != @prevCity then

     set @prevCity = @City

     write(concat("<li>",@City,"</li>"))

  endif

  if @rowCount == @rowCount then

    write(concat("</ul>"))

  endif 


next @i 

]%%

Reference

Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88