Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 407

Inserting data from data extension into email using ampscript

$
0
0

I'm trying to create a report like email that will send an email to me that includes all the data in the data extension. When I run do preview and test the email, I get the fall back message - No records found in data extension. The data extension has 65 records in it.

Below is the code I have:

%%[/* Retrieve all rows from the data extension */SET @rows = LookupRows("Email Using All Subscribers Publication List", "JobID", ">0")/* Check if there are any rows found */IF RowCount(@rows) > 0 THEN]%%<table border="1"><tr><th>AccountUserID</th><th>EmailName</th><th>FromEmail</th><th>EventDate</th><th>Category</th><th>JobID</th><th>UserName</th></tr>    %%[ /* Start a loop to iterate through each row */        FOR @i = 1 TO RowCount(@rows) DO            /* Get the current row */            SET @row = Row(@rows, @i)            /* Retrieve column values for the current row */            SET @AccountUserID = Field(@row, "AccountUserID")            SET @EmailName = Field(@row, "EmailName")            SET @FromEmail = Field(@row, "FromEmail")            SET @EventDate = Field(@row, "EventDate")            SET @Category = Field(@row, "Category")            SET @JobID = Field(@row, "JobID")            SET @UserName = Field(@row, "UserName")    ]%%<tr><td>%%=v(@AccountUserID)=%%</td><td>%%=v(@EmailName)=%%</td><td>%%=v(@FromEmail)=%%</td><td>%%=v(@EventDate)=%%</td><td>%%=v(@Category)=%%</td><td>%%=v(@JobID)=%%</td><td>%%=v(@UserName)=%%</td></tr>    %%[ NEXT @i ]%%</table>%%[ ELSE ]%%    No rows found in the data extension.%%[ ENDIF ]%%

Viewing all articles
Browse latest Browse all 407

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>