0

How many records can I add at a time from one Data Extension to another using Server-side JavaScript? I have 9000 records when I add records to Data Extension only 4000 records are inserted. What is the limitation in my code?

<script runat="server">

Platform.Load("Core","1");
var birthdayDE = DataExtension.Init("sent");
var newList = DataExtension.Init("sent3")
var data = birthdayDE.Rows.Retrieve();

//Write(Stringify(data));

for (var i = 0; i < data.length; i++) {

    var sub = data[i];
    var dd1 = sub.JobID;
    var dd2 = sub.SubscriberKey;
    var dd3 = dd1 + dd2;
    var aa2 = GUID()

    var aa = {JobID__c:sub.JobID,Domain__c:sub.Domain,AccountID__c:sub.AccountID,SubscriberKey__c:sub.SubscriberKey,EventDate__c:sub.EventDate,add__c:dd3,guid__c:aa2};
    var bb = Stringify(aa);
    Write(Stringify(bb));

    newList.Rows.Add({object:"sent",method:"insert",Body:bb,add:dd3,guid:aa2});
}   

</script>

I am moving data from sent to sent3.

2
  • @Data_Kid how to retrive more than 2500 records from Dataextension using Sever-side-javascript or ampscript
    – user C
    Commented May 5, 2017 at 12:09
  • 2
    Irrespective of your question, you look to be settling on a pretty bad design pattern, based on your code. Would you mind expanding the question to what you want to achieve. I'm fairly certain the way you're tackling the problem needs addressing ahead "how many rows I can update with SSJS".
    – Macca
    Commented May 6, 2017 at 14:07

1 Answer 1

2

I guess you are having problem with accessing records, if records are more than 4000. This is default limitation by Marketing Cloud which enhances script performance. So, you can make that possible by using AMPScript:

Step 1: First you count all records and store in one variable-

Var @Counter 
Set @Counter = DataExtensionRowCount("DEName")

Step 2: After that the same counter you can use in LookupOrderedRows() function while fetching the records:

Set @Records = LookupOrderedRows("DEName",@Counter,"TestA Desc".......)

Once you setup like that, after that you able to deal with all the records which is available in DEName (even its more than 4000).

You must log in to answer this question.

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