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 ]%%
1
  • Remember to mark my answer as accepted if it has been helpful Feb 20 at 9:24

1 Answer 1

0

You can’t use such “greater than” operator in LookupRows. Only simple conditions, where you compare a field to a specific value is supported. I will suggest adding a new field with default value of e.g. 1 and use this to fetch all the rows:

SET @rows = LookupRows("Email Using All Subscribers Publication List", "new_field", "1")

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .