Hello everyone, I'm using a search, and getting th...
# suitescript
s
Hello everyone, I'm using a search, and getting the PagedData, in teh PageData we get thee pageRanges, which I'm trying to loop to get the index and dynamically get the data for each page
Copy code
const pageRange = pagedData.pageRanges

_.each(pageRange,function(range){
     lf.debug("PAGE RANGE OBJ", Object.keys(range));
     lf.debug("PAGE INDEX", range.index);
    const json = range.toJSON();
     lf.debug("PAGE TO JSON INDEX", json.index);
    var dataFeed =  processProductData(pagedData.fetch({index:range.index}).data);
     // lf.debug("After One PAge USAGE", rtf.getRemainingUsage());
 })
The issue i'm having is that the range.index is undefined for whatever reason, and when I log the range object the index is there. Does anybody know what could be happening? is this an NS issue or is the index not reachable dynamically this way and I should use another way to loop the search result pages?
e
You could try;
Copy code
_.each(pageRange, function(range, index){    
    var dataFeed = processProductData(pagedData.fetch({index:index}).data);   
 })