• Scott Keith
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
In the Marketing Cloud I want to use a SSJS script activity to retrieve records from a Data Extension, manipulate them, and write back to a new DE. I've tried using DATAEXTENSION.Rows.Retrieve(), but am limited to pulling back only 2,500 records. Instead, I am trying to use API calls from inside the platform to take advantage of (results[0] == "MoreDataAvailable"). I can now get the full recordset back; which is verified by OBJECT.Length. How can I access the individual field values? I'm trying to get STRINGIFY() or ROW() to help, but failing so far. Below is script I put into a landing page to work through the retrieve and the results displayed on the screen. "OrderheaderID" is a field name from the source data extension.

CODE:
<script runat=server>
          Platform.Load("Core","1.1.1");
          var rr = Platform.Function.CreateObject("RetrieveRequest");
          Platform.Function.SetObjectProperty(rr, "ObjectType", "DataExtensionObject[test_OrderLineItem]");
          Platform.Function.AddObjectArrayItem(rr, "Properties", "OrderheaderID"); // OrderheaderID is a field name

         do
         {
            var results = [0,0];
            var rows = Platform.Function.InvokeRetrieve(rr, results);
            if(rows != null) {
              Write("<br>results0: " + results[0]); 
              Write("<br>results1: " + results[1]);  
              Write("<br>rows0: " + rows[0]); //returning null
              Write("<br>rows1: " + rows[1]); 
              Write("<br>rowsLength: " + rows.length); 
              Write("<br>rows.orderheaderId: " + rows.OrderheaderID);  //returning undefined
              Write("<br>rows[0].orderheaderId: " + rows[0].OrderheaderID);
              Write("<br>rows[1].orderheaderId: " + rows[1].OrderheaderID);
            }
             rr.ContinueRequest = results[1];
          } while (results[0] == "MoreDataAvailable")
  </script>

RESULTS: 
results0: MoreDataAvailable
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 2500
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined

results0: OK
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 1615
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined
 
In the Marketing Cloud I want to use a SSJS script activity to retrieve records from a Data Extension, manipulate them, and write back to a new DE. I've tried using DATAEXTENSION.Rows.Retrieve(), but am limited to pulling back only 2,500 records. Instead, I am trying to use API calls from inside the platform to take advantage of (results[0] == "MoreDataAvailable"). I can now get the full recordset back; which is verified by OBJECT.Length. How can I access the individual field values? I'm trying to get STRINGIFY() or ROW() to help, but failing so far. Below is script I put into a landing page to work through the retrieve and the results displayed on the screen. "OrderheaderID" is a field name from the source data extension.

CODE:
<script runat=server>
          Platform.Load("Core","1.1.1");
          var rr = Platform.Function.CreateObject("RetrieveRequest");
          Platform.Function.SetObjectProperty(rr, "ObjectType", "DataExtensionObject[test_OrderLineItem]");
          Platform.Function.AddObjectArrayItem(rr, "Properties", "OrderheaderID"); // OrderheaderID is a field name

         do
         {
            var results = [0,0];
            var rows = Platform.Function.InvokeRetrieve(rr, results);
            if(rows != null) {
              Write("<br>results0: " + results[0]); 
              Write("<br>results1: " + results[1]);  
              Write("<br>rows0: " + rows[0]); //returning null
              Write("<br>rows1: " + rows[1]); 
              Write("<br>rowsLength: " + rows.length); 
              Write("<br>rows.orderheaderId: " + rows.OrderheaderID);  //returning undefined
              Write("<br>rows[0].orderheaderId: " + rows[0].OrderheaderID);
              Write("<br>rows[1].orderheaderId: " + rows[1].OrderheaderID);
            }
             rr.ContinueRequest = results[1];
          } while (results[0] == "MoreDataAvailable")
  </script>

RESULTS: 
results0: MoreDataAvailable
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 2500
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined

results0: OK
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 1615
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined
 
In the Marketing Cloud I want to use a SSJS script activity to retrieve records from a Data Extension, manipulate them, and write back to a new DE. I've tried using DATAEXTENSION.Rows.Retrieve(), but am limited to pulling back only 2,500 records. Instead, I am trying to use API calls from inside the platform to take advantage of (results[0] == "MoreDataAvailable"). I can now get the full recordset back; which is verified by OBJECT.Length. How can I access the individual field values? I'm trying to get STRINGIFY() or ROW() to help, but failing so far. Below is script I put into a landing page to work through the retrieve and the results displayed on the screen. "OrderheaderID" is a field name from the source data extension.

CODE:
<script runat=server>
          Platform.Load("Core","1.1.1");
          var rr = Platform.Function.CreateObject("RetrieveRequest");
          Platform.Function.SetObjectProperty(rr, "ObjectType", "DataExtensionObject[test_OrderLineItem]");
          Platform.Function.AddObjectArrayItem(rr, "Properties", "OrderheaderID"); // OrderheaderID is a field name

         do
         {
            var results = [0,0];
            var rows = Platform.Function.InvokeRetrieve(rr, results);
            if(rows != null) {
              Write("<br>results0: " + results[0]); 
              Write("<br>results1: " + results[1]);  
              Write("<br>rows0: " + rows[0]); //returning null
              Write("<br>rows1: " + rows[1]); 
              Write("<br>rowsLength: " + rows.length); 
              Write("<br>rows.orderheaderId: " + rows.OrderheaderID);  //returning undefined
              Write("<br>rows[0].orderheaderId: " + rows[0].OrderheaderID);
              Write("<br>rows[1].orderheaderId: " + rows[1].OrderheaderID);
            }
             rr.ContinueRequest = results[1];
          } while (results[0] == "MoreDataAvailable")
  </script>

RESULTS: 
results0: MoreDataAvailable
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 2500
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined

results0: OK
results1: 9b2c8d3f-4a63-4573-b122-ecfe29af41e0
rows0: 
rows1: 
rowsLength: 1615
rows.orderheaderId: undefined
rows[0].orderheaderId: undefined
rows[1].orderheaderId: undefined