Wednesday, August 28, 2013

Heavy AMPscript coding last few days. ExactTarget so robust compared to Silverpop, but still like some SP things better

ExactTarget's AMPscript is so far advanced to Silverpop's WYSIWYG scripting. You can really do some cool stuff. I don't like how ET handles lists/databases though, but I'll take the great with the not so great.

I have been working on a project that needed a relational table connected to the recipient list. In ET they had a function called "data relationships" and a "multi-join" filter that seemed to be what I was looking for. But I spent a day going down that road and came to a dead end.

I called support and explained what I was trying to do and how I was looking at the data relationship function to try and do this. Well, they told me that this would not get er done. This was relating two tables, but it only a one-to-one relationship, and I needed one-to-many. 

The support person was even sure that what I wanted to do was possible. He suggested I talk with my "Relationship Manager". Well, this was the client's account and the client was using a 3rd party reseller, so that wasn't any help.

ET uses their own proprietary scripting language called AMPscript, so compared to other languages, there is not much info out there on it. They do have a lot of info on their own site and message boards, but it's seem like it's always a pain finding what I'm looking for, and this time was no different.

I eventually found an example that was in the ball park, and I was off and running after that. It took me quite a while to even see any light at the end of the tunnel. I couldn't find syntax for custom function, arrays, etc. 

At the time of this writing I have successfully connected to a table and extracted data from it, and rendered it in my email, so that's a huge step. I still need to loop through records and filter out empty fields. This might sound easy, but I'm dealing with a lot of unfamiliar syntax. 

Here's the key to it all working:

Connect to and get records:::
SET @multiRows = LookupRows("DATA_EXT_NAME","FIELD NAME",[SUBSCRIBER_KEY])

Loop through the rows:::
for @i = 1 to RowCount(@multiRows) do

Set @row = Row(@multiRows,@i)

Get data from the fields in the row::::
Set @LAST_NAME = Field(@row,"LAST_NAME")
Set @CLIENT_ID = Field(@row,"CLIENT_ID")
Set @PATIENT_ID = Field(@row,"PATIENT_ID")

 next @i 

I'm getting there. 

No comments:

Post a Comment