0

I am using a simple JavaScript to receive a row from Data Extension Server-Side JavaScript Functions in ExactTarget and display the retrieved row on Landing Page . As below

<script runat="server">  Platform.Load("core", "1");
var birthdayDE = DataExtension.Init("birthdayDE");
var filter = {
    Property: "EmailAddress",
    SimpleOperator: "equals",
    Value: "[email protected]"
};
var data = birthdayDE.Rows.Retrieve(filter);
if (data.length > 0) {
    Write("<table border='1' cellpadding='2' cellspacing='3' style='border-collapse:collapse;>");
    for (var i = 0; i <= data.length; i++) {
        var d = data[i];
        Write("<tr>");
        for (var key in d) {
            Write("<td>" + d[key] + "</td>");
        }
        Write("</tr>");
    }
    Write("</table>");} </script>

Somehow it does not show me any results nor give any errors.

14
  • Not entirely clear on how this relates to salesforce?
    – Eric
    Commented Dec 4, 2014 at 18:22
  • @Eric..I am trying to use "Data Extension Server-Side JavaScript Function" Retrieve(filter, QueryAllAccounts) and display the retrieved row on the landing page.
    – CodeDiva
    Commented Dec 4, 2014 at 18:36
  • are you seeing any javascript errors within your browsers console?
    – Double A
    Commented Dec 4, 2014 at 19:23
  • No it is not giving me any kind of error.
    – CodeDiva
    Commented Dec 4, 2014 at 19:30
  • What is the value of data.length?
    – Timothy
    Commented Dec 4, 2014 at 21:00

1 Answer 1

0

You're missing a single quote at the end of the style attribute in your table tag.

<script runat="server">
    Platform.Load("core", "1");
    var birthdayDE = DataExtension.Init("birthdayDE");
    var filter = {
        Property: "EmailAddress",
        SimpleOperator: "equals",
        Value: "[email protected]"
    };
    var data = birthdayDE.Rows.Retrieve(filter);
    Write("<br>data.length: " + data.length);

    if (data.length > 0) {

        Write("<table border='1' cellpadding='2' cellspacing='3' style='border-collapse:collapse;'>");
        for (var i = 0; i <= data.length; i++) {

            var d = data[i];
            Write("<tr>");
            for (var i in d) {
                Write("<td>" + d[i] + "</td>");
            }
            Write("</tr>");
        }
        Write("</table>");
    }
</script>
1
  • Thanks...I think it was missed while copying the code. Though I have that in my original code.
    – CodeDiva
    Commented Dec 4, 2014 at 23:30

You must log in to answer this question.

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