I'm trying to build some logic using AMPscript to only pull RSS entries if the "lastBuildDate" (or last day that a post was published) is within the past week. I'm having a hard time pulling the date from the feed.
I can get all the info I want from individual items, but I can't pull any of the values specific to the feed itself (title feed, description, language, etc.).
Here's my code:
<h1 style="font: bold normal 1.0em Arial, Helvetica, sans-serif;">LEVEL ONE</h1>
%%[Set @xml = ContentAreaByName("my contents\RSSParse-level-one")
Set @titles = BuildRowsetFromXML(@xml,"//item/title",1)
Set @descs = BuildRowsetFromXML(@xml,"//item/description",1)
Set @pubdas = BuildRowsetFromXML(@xml,"//item/pubDate",1)
Set @links = BuildRowsetFromXML(@xml,"//item/link",1)
Set @builddates = BuildRowsetFromXML(@xml,"//lastBuildDate",1)
Set @builddate = Field(Row(@builddates,1), "Value")
SET @rows = RowCount(@titles)
IF @rows >= 1 THEN
for @cnt = 1 to @rows do
Set @pubda = Field(Row(@pubdas,@cnt), "Value")
IF DateDiff(NOW(),@pubda, "D") <= 7 THEN
Set @title = Field(Row(@titles,@cnt),"Value")
Set @desc = Field(Row(@descs,@cnt), "Value")
Set @link = Field(Row(@links,@cnt), "Value") ]%%
<div style="border-bottom: 1px solid #CBCAD2; padding-bottom:5px; padding-top:3px;">
<a style="text-decoration:none; color: #000000; font-weight: bold; font-size: 16px; font-family: Arial, Helvetica, sans-serif;" href="%%=RedirectTo(@link)=%%" alias="%%=v(@title)="%%" title="%%=v(@title)=%%">%%=v(@title)=%%</a><span style=" font-size:11px; text-decoration:none; font-weight: normal;"> | %%=Format(@pubda, "MMMM d, yyyy")=%%</span><br/>
%%=v(@desc)=%%<br/>%%=v(@xml)=%%%%=v(@builddate)=%%
</div>
%%[
ENDIF
NEXT @cnt
ELSE ]%%
<h1 style="font: bold normal 1.0em Arial, Helvetica, sans-serif;">Nothing to Display</h1>
%%[
ENDIF
]%%
<table cellpadding="2" cellspacing="0" width="600" ID="Table5" Border=0><tr><td><font face="verdana" size="1" color="#444444">This email was sent by: <b>%%Member_Busname%%</b><br>%%Member_Addr%% %%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%%<br><br></font></td></tr></table>
<a href="%%profile_center_url%%" alias="Update Profile">Update Profile</a>
<custom name="opencounter" type="tracking">
Specifically, I need help with this part:
Set @builddates = BuildRowsetFromXML(@xml,"//lastBuildDate",1)
Set @builddate = Field(Row(@builddates,1), "Value")
httpget()
line.