0

I would like to limit the amount of subscribers retrieved with the following function:

var myList = List.Init(listExternalKey);
var subsArray = myList.Subscribers.Retrieve();

When used on a large list (~8000), the Landing Page times out when using this function.

Is there any way to count the items in the array as it's being retrieved and stop after 200? I don't need the rest of the subscribers if it's not possible to carry on retrieving the rest of them.

The documentation only refers to filtering by specific subscribers, but I don't know which subscribers are in there - and only want x amount of them anyways even if I did. http://help.exacttarget.com/en/documentation/exacttarget/content/server_side_javascript/server_side_javascript_syntax_guide/core_library_server_side_javascript_functions/list_server_side_javascript_functions/

Any help would be much appreciated!

1 Answer 1

0

Retrieve will returns the data in the form of Array. Use length keyword to check the array size and initialized the count in the for loop.

Example:

var myList = List.Init(listExternalKey); var subsArray = myList.Subscribers.Retrieve(); for(var i=0; subsArray.length>i&&200>i; i++) { Write(subsArray[i].EmailAddress +'<br/>')
}

3
  • Hi Palash! Thank you for your help on this, I have run some tests with the above "for loop" and I don't believe it makes much of a difference as the system spends the majority of the time retrieving, and then a short amount of time putting it into an array. My timestamps are finding that it takes 64 seconds to perform the retrieve 365 subscribers and 0.062 seconds to display 200 records. Do you know of any other method that can be used? Aug 31, 2015 at 14:09
  • Hi Palash. Just to update, it looks like the best way to retrieve the subscribers is to rather use a Script Activity, as these Activities have much longer timeout periods. Sep 10, 2015 at 10:15
  • Hi Carswell! Yes, we can use a Script Activity for handling timeout periods. Thanks for letting me know.
    – Palash Rai
    Sep 11, 2015 at 5:18

You must log in to answer this question.

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