0

I have a dropdown menu and I am using AMPscript to populate my dropdown from the ItemName column in my Data Extension. I am not certain how to get all values in the ItemName column so that I can bind them to my dropdown. This is still relatively new to me. So if you need more info please let me know

Here is my start. And I know my @curList is missing something, just not sure what.

SET @curList = LookupOrderedRowsCS(@listDe,0, @ItemName)

Row Count: %%=ROWCOUNT(@curList) =%%

(I know I can set i to Row Count and loop through to bind the records to the dropdown.)

Thank you

0

Here's an example. You can modify the output to build your select options.

%%[
var @rows, @row, @rowCount, @numRowsToReturn, @lookupValue, @i

set @lookupValue = "whee"
set @numRowsToReturn = 0 /* 0 means all */
set @rows = LookupOrderedRows("DataExtensionName",@numRowsToReturn,"DEColumn1 desc, DEColumn2 asc","LookupColumn", @lookupValue)
set @rowCount = rowcount(@rows)

if @rowCount > 0 then

for @i = 1 to @rowCount do

var @DEColumn1, @DEColumn2
set @row = row(@rows,@i) /*get row based on loop counter */
set @DEColumn1 = field(@row,"DEColumn1")
set @DEColumn2 = field(@row,"DEColumn2")

]%%

Row %%=v(@i)=%%, DEColumn1 is %%=v(@DEColumn1)=%%, DEColumn2 is %%=v(@DEColumn2)=%%

%%[

next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%
| improve this answer | |

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.