I'm trying to make a landing page that can return send history details for a subscriber, I can get to the point of having subscriber key, JobID, and EventDate pulling through by running LookUpOrderedRows on the _Sent data view, but if I try to pull in EmailName with a lookup, this returns a NULL - is there a way I can do this, or am I barking up the wrong tree? Code here:
%%[
var @ReturnRows
set @ReturnRows = 0 /* Use 0 to get all results */
var @GetRows
set @GetRows = LookupOrderedRows("ent._Sent",@ReturnRows,"EventDate DESC","SubscriberKey", @SubsKey_Column) /* syntax of LookupOrderedRows */
var @GetRow, @GetRowCount
set @GetRowCount = rowcount(@GetRows)
if @GetRowCount > 0 then /* if search term or criteria matches with the data in the data extension then we will get 1 or more rows*/
var @GetRowNumber
for @GetRowNumber = 1 to @GetRowCount do /* FOR LOOP for each row */
set @GetRow = row(@GetRows,@GetRowNumber) /* calculate row number */
var @JobID_column
set @JobID_column = field(@GetRow,"JobID") /* display value of the column from data extension */
var @SentTime_Column
set @SentTime_Column = field(@GetRow,"EventDate") /* display value of the column from data extension */
var @EmailName_Column
set @EmailName_Column = Lookup("ent._Job", "EmailName", "JobID", @JobID_column)
]%%
Job ID : %%=v(@JobID_Column)=%% | Email Name: %%=v(@EmailName_Column)=%% |Sent Time : %%=v(@SentTime_Column)=%%
<br>
%%[ next @i ]%%
%%[ else ]%%
<!-- If search term does not match with the data for any record in data extension -->
---- No rows found ----
%%[ endif ]%%
This returns the following sample row on my landing page:
Job ID : xxxxxx | Email Name: |Sent Time : 12/5/2017 11:28:35 PM