0

I would like to insert a loop within a loop, this is the working first loop pulling in content from an external DE, how would I loop this over again?

---- updated working script below ------

%%[ var @rows, @row, @rowCount var @lookupValue set @lookupValue = AttributeValue("evtStart")

set @lookupValue = "Friday" set @rows = LookupRows("WCOTW_final","evtStart", @lookupValue) set @rowCount = rowcount(@rows)

if @rowCount > 0 then

for @allDate = 1 to @rowCount do

/* --- set the var for the rows you want to display --- */ var @ProductCode, @ProductName, @Credits set @row = row(@rows,@allDate) set @ProductCode = field(@row,"ProductCode") set @ProductName = field(@row,"ProductName") set @Credits = field(@row,"Credits")

    if @allDate == 1 then
     outputline(concat("<p>"))
    endif


    ]%%

   <p style="text-align: left">

Product Name is %%=v(@ProductName)=%%

Product Code : %%=v(@ProductCode)=%%

Credits = %%=v(@Credits)=%%

%%[ if @allDate == @rowcount then outputline(concat("

")) endif next @i ]%% %%[ else ]%% No rows %%[ endif ]%%

3

Take a look at the function lookup.

You have a mistake at the stuff you are searching for. It cannot be Surname unless its being a value of the subscriber table. But even then i would write it differently

%%[ var @surname
set @surname = lookup('test_DE_name','Surname','SearchingColumn',"ValueYouWantToSearchFor" ) 
]%%

%%=v(@surname)=%%

I guess you understood something wrong and you would like to have it this way?

%%[ 
var @surname
set @surname = AttributeValue('surname') /* if the column is called surname */
set @OtherValue= lookup('test_DE_name','OtherColumn','Surname',@surname ) 
]%%

%%=v(@OtherValue)=%%

or this way?

%%[ 
var @subscriberkey
set @subscriberkey= AttributeValue('_subscriberkey')
set @surname= lookup('test_DE_name','Surname','subscriberkeyColumnname',@subscriberkey ) 
]%%

%%=v(@surname)=%%
2

I am not sure if you missed a "not" before "working". I make the assumption that it is not working. First and foremost, the Lookup function takes 4 parameters, not 3. https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/lookup.htm

%%[ var @surname set @surname = lookup('test_DE_name','Column to return', 'Surname',Surname ) ]%%

Secondly, Is the last Surname in below code a variable or do you try to hard code it?

%%[ var @surname set @surname = lookup('test_DE_name','Surname', Surname) ]%%

If it is a variable, make sure it has a value and has the @ as prefix.

%%[ var @surname set @surname = lookup('test_DE_name','Surname', @Surname) ]%%

If you are trying to hard code a value, you should surround it with ''

%%[ var @surname set @surname = lookup('test_DE_name','Surname', 'Surname') ]%%
  • Thanks for the answers for the original loop, can anyone suggest how I could loop within a loop – Factor33 Nov 21 '19 at 15:28

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.