I wanted to test the script below in Landing page but I am getting the following error:

startIndex cannot be larger than length of string

Any suggestions why this error occurs and how to fix it? By removing do - while loop the page will load just fine so I assume it something to do with it.

This is my code:

<script runat="server">

  var rr = Platform.Function.CreateObject("RetrieveRequest");
  Platform.Function.SetObjectProperty(rr, "ObjectType", "DataExtensionObject[489FCA33-8204-4A2F-A7D6-8B59F3963EB2]");
  Platform.Function.AddObjectArrayItem(rr, "Properties", "Email_Address");

  do {

    var results = [0,0];
    var rows = Platform.Function.InvokeRetrieve(rr, results);
    var status = results[0];
    var requestId = results[1];
    Write("<br>status: " + status);
    Write("<br>requestId: " + requestId);

    if (rows != null) {

       Write("<br>rows.length: " + rows.length);

       for (var i in rows) {
         Write("<br>i:" + i + " " + rows[i].Properties[0].Value);

    rr.ContinueRequest = requestId;

  } while (status == "MoreDataAvailable")

1 Answer 1


Put a semicolon (;) at the end of while loop. It works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.