# Error Script time out

**URL:** <https://community.postman.com/t/error-script-time-out/33275>\
**Category:** Help Hub\
**Tags:** scripts, etimedout\
**Created:** [March 8, 2022, 5:32am UTC](https://community.postman.com/t/error-script-time-out/33275 "2022-03-08T05:32:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![philin21](https://avatars.discourse-cdn.com/v4/letter/p/41988e/32.png) [@philin21](https://community.postman.com/u/philin21)\
**Post date:** [March 8, 2022, 5:32am UTC](https://community.postman.com/t/error-script-time-out/33275/1 "2022-03-08T05:32:08Z")

</div>

> Here’s an outline with best practices for making your inquiry.

_My question_: I am getting script timeout error .  
I am new to postman and trying to run some codes to loop through 6000 records and validate the values. Currently in my code i have only set to go through 1000, but as the program runs it thrown error as script time out error.

can anyone please review why and what I should do to rectify this problem . Thanks a lot in advance.

_Details (like screenshots)_:

//Check that the service is active

pm.test(“Status code is 200”, function () {

```
pm.response.to.have.status(200);

pm.response.to.be.json;

```

});

//get the response data

let jsonData = pm.response.json();

//variable declaration to count how many have a reading Type ID

let vPass = 0;

let vFail = 0;

//variable declaration to count how many have Forecast values

let vForecast0 = 0;

let vForecast1 = 0;

//Variable to hold no of records in the reponse.

var data = pm.response.json().forecastData.generatedMW;

//Vairiable to hold the response object

var readingTypeID;

var forecast;

//Log how many records are in the response

console.log(“Total No of Records :” + data.length);

//Check if the file is in json format

pm.test(“File is Json”, function () {

```
    pm.response.to.be.json;

```

});

setTimeout(function(){}, 2000000);

//Go through each object in responsebody

for (let i=0;i \< 1000;i++)

{

```
//Assign the value for each object iteration

readingTypeID = pm.response.json().forecastData.generatedMW[i].readingTypeID;

forecast= pm.response.json().forecastData.generatedMW[i].forecast;

    //Check the readingTypeID

    switch (readingTypeID) {

        case "FL":

            vPass++;

            break;

        case "FM":

            vPass++;

            break;

        case "FH":

            vPass++;

            break;

        default:

            vFail++;

    }

     //Check the Forecast Value

    if (forecast >= 0)

    {

        vForecast1++;

    }

    else

    {

        vForecast0++;

    }

```

}

//Print all the values to Console.

console.log ("vPass " + vPass);

console.log ("vFail " + vFail);

console.log ("vForecast1 " + vForecast1);

console.log ("vForecast0 " + vForecast0);

_I’ve already tried_: I have tried to increase the time by adding the script “setTimeout(function(){}, 2000000);” \<\< Not sure if this is correct and in the right place.
