# conditional saving of Response data in http

**URL:** <https://community.gatling.io/t/conditional-saving-of-response-data-in-http/3086>\
**Category:** Gatling (Open-Source)\
**Created:** [June 16, 2016, 9:43pm UTC](https://community.gatling.io/t/conditional-saving-of-response-data-in-http/3086 "2016-06-16T21:43:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chandu\_D](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Chandu\_D](https://community.gatling.io/u/Chandu_D)\
**Post date:** [June 16, 2016, 9:43pm UTC](https://community.gatling.io/t/conditional-saving-of-response-data-in-http/3086/1 "2016-06-16T21:43:22Z")

</div>

Ok, I got this resolved using “doIfOrElse” block like this :

```auto
doIfOrElse(logger.isDebugEnabled()){
  exec(
    http("LandingPage")
      .get("/login") ///c11/v1603.116/729542582413511/login

      .header("Accept","text/plain; charset=utf-8")
      .header("Upgrade-Insecure-Requests","1")
      .check(status.in(200,302))
      .check(bodyString.saveAs("qboLandingPageValidPayload"))
      .check(responseTimeInMillis.saveAs("execLatency"))
      .check(regex("name=\"parentID\" value=\"(.*?)\"><input id=").saveAs("parentid"))
  )
}
{
  exec(
    http("LandingPage")
      .get("/login") ///c11/v1603.116/729542582413511/login
      .header("Accept","text/plain; charset=utf-8")
      .header("Upgrade-Insecure-Requests","1")
      .check(status.in(200,302))
      .check(responseTimeInMillis.saveAs("execLatency"))
      .check(regex("name=\"parentID\" value=\"(.*?)\"><input id=").saveAs("parentid"))
  )
}

```
