How to add a condition count > 8 in Gatling script?

I want to add a below condition in http request, which gives me KO status if that condition matches. My condition is WorkflowFailed = True OR count > 8 then status will be failed.

For one of the above condition WorkflowFailed = True I have added below code and it works fine, but for count > 8 it doesnt work.

.check(jsonPath("$.failed").transform(status => status == "true").is(false))

I have also tried with this code, but didn’t work and throws error.

.check(jsonPath("$.failed").transform(status => status == "true" || count > 8).is(false))

19:00:52.143 [ERROR] i.g.c.ZincCompiler$ - D:…\gatling-charts-highcharts-bundle-2.1.7\user-file s\simulations\LaunchResources.scala:83: value > is not a member of java.util.concurrent.atomic.AtomicInteger 19:00:52.144 [ERROR] i.g.c.ZincCompiler$ -
.check(jsonPath("$.failed"). transform(status => status == “true” || count > 8).is(false)) 19:00:52.144 [ERROR] i.g.c.ZincCompiler$ - ^ 19:00:52.222 [ERROR] i.g.c.ZincCompiler$ - one error found

Here is the code,

class LaunchResources extends Simulation {

    val scenarioRepeatCount = Integer.getInteger("scenarioRepeatCount", 1).toInt
    val userCount = Integer.getInteger("userCount", 1).toInt
    val UUID  = System.getProperty("UUID", "24d0e03")
    val username = System.getProperty("username", "p1")
    val password = System.getProperty("password", "P12")
    val testServerUrl = System.getProperty("testServerUrl", "https://someurl.net")
    val count = new java.util.concurrent.atomic.AtomicInteger(0)

    val httpProtocol = http
        .baseURL(testServerUrl)
        .basicAuth(username, password)
        .connection("""keep-alive""")
        .contentTypeHeader("""application/vnd+json""")

    val headers_0 = Map(
        """Cache-Control""" -> """no-cache""",
        """Origin""" -> """chrome-extension://fdmmgasdw1dojojpjoooidkmcomcm""")

    val scn = scenario("LaunchAction")
        .repeat (scenarioRepeatCount) {
            exec(http("LaunchAResources")
                .post( """/api/actions""")
                .headers(headers_0)
                .body(StringBody(s"""{"UUID": "$UUID", "stringVariables" : {"externalFilePath" : "/Test.mp4"}}"""))
                .check(jsonPath("$.id").saveAs("WorkflowID")))

        .exec(http("SaveWorkflowStatus")
                .get("""/api/actions/{$WorkflowID}""")
                .headers(headers_0)
                .check(jsonPath("$.status").saveAs("WorkflowStatus")))

        }

     .asLongAs(session => session.attributes("WorkflowStatus") != "false" && count.getAndIncrement() < 8) {
        doIf(session => session("WorkflowFailed").validate[String].map(WorkflowFailed => !WorkflowFailed.contains("true")).recover(true)) 
        {
        pause(pauseTime)
        .exec(http("SaveWorkflowStatus")
                .get("""/api/actions/${WorkflowID}""")
                .headers(headers_0)
                .check(jsonPath("$.running").saveAs("WorkflowStatus"))
                .check(jsonPath("$.failed").saveAs("WorkflowFailed"))
                .check(jsonPath("$.failed").transform(status => status == "true").is(false))     // Added this line to fail 1st condition which is (WorkflowFailed = True) then mark as KO. Works fine.
                )

        .exec(session => {
                val wflowStatus1 = session.get("WorkflowStatus").asOption[String]
                val wflowFailed1 = session.get("WorkflowFailed").asOption[String]
                println("Inner Loop Workflow Status: ========>>>>>>>> " + wflowStatus1.getOrElse("COULD NOT FIND STATUS"))
                println("Inner Loop Workflow Failed?? ========>>>>>>>> " + wflowFailed1.getOrElse("COULD NOT FIND STATUS"))
                println("Count =====>> " + count)
                session}) 
        }
        }   

    setUp(scn.inject(atOnceUsers(userCount))).protocols(httpProtocol)

}

" value > is not a member of java.util.concurrent.atomic.AtomicInteger 19:00:52.144 [ERROR] i.g.c.ZincCompiler$ -"

AtomicInteger doesn’t support >. Use count.get()

Regards,
Niharika