3

I'm trying to use a data extension in ExactTarget to store a bunch of HTTPGet results from various feeds I'm using to build a large newsletter.

However, I've been unable to make the AMPScript function for inserting data into a data extension work. In the code below, I'm trying to put data into a data extension named "6306_content" in two columns: "Label" and "Content". Everything works well until I get to the "InsertDE" function call:

%%[

/* This script should get data from a feed and populate them into a data extension */

Var @xml_featured, @titlefeatured, @titles_featured, @descfeatured, @descs_featured, @linkfeatured, @links_featured, @cnt, @featured_rss, @rows, @featured_name, @featured_url

/* Get XML data from HTTPGet call in separate content area  */

Set @xml_featured = ContentAreaByName("my contents\TEST_get_featured_stories")

Set @titles_featured = BuildRowsetFromXML(@xml_featured,"//item/title",1)
Set @descs_featured = BuildRowsetFromXML(@xml_featured,"//item/description",1)
Set @links_featured = BuildRowsetFromXML(@xml_featured,"//item/link",1)

/* Set count of rows to desired number of featured stories */

If RowCount(@titles_featured) > 3 THEN
SET @rows = 3
ELSE
SET @rows = RowCount(@titles_featured)
ENDIF

/* Iterate through desired number of rows to retrieve, set and display values in the row sets */

IF @rows >= 1 THEN
for @cnt = 1 to @rows do

Set @titlefeatured = Field(Row(@titles_featured,@cnt),"Value")
Set @descfeatured = Field(Row(@descs_featured,@cnt),"Value")
Set @linkfeatured = Field(Row(@links_featured,@cnt),"Value") 

/* ERROR OCCURS BELOW HERE */

InsertDE("6306_content", "Label", titlefeatured, "Content", @titlefeatured)
InsertDE("6306_content", "Label", descfeatured, "Content", @descfeatured)
InsertDE("6306_content", "Label", linkfeatured, "Content", @linkfeatured)

]%%

Output is:  
%%=Lookup("6306_content","Content","Label",titlefeatured)=%%
%%=Lookup("6306_content","Content","Label",descfeatured)=%%
%%=Lookup("6306_content","Content","Label",linkfeatured)=%%

%%[
NEXT @cnt 
ENDIF
]%%

So, I'm just having trouble when I get to that "InsertDE" function call and haven't managed to successfully add anything to a data extension. Am I missing something or taking the wrong approach with this?

1 Answer 1

1

Is the "Label" field content supposed to be titlefeatured, etc? If so, these should be strings.

InsertDE("6306_content", "Label", "titlefeatured", "Content", @titlefeatured)
InsertDE("6306_content", "Label", "descfeatured", "Content", @descfeatured)
InsertDE("6306_content", "Label", "linkfeatured", "Content", @linkfeatured)

2
  • 1
    The value of the "Label" field is supposed to be Field(Row(@titles_featured,@cnt),"Value")
    – Eric
    Commented Aug 21, 2014 at 12:52
  • What is the schema of 6306_content? Commented Aug 21, 2014 at 22:04

You must log in to answer this question.

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