Store value of query in varaible

I created a javascript query, that triggers an SQL query with a variable. The SQL query returns a result of one column with one cell, with numeric value.
I'm trying to store the result (as it's only one value), in a variable and use that variable inside the code. however, I couldn't find a command that doing it without losing the value (everything I tried stores a null value in the variable)

Any suggestions?

** adding here my current code which isn't working as I want

image

image

image

var result = await total_stim.trigger({
    additionalScope:{
         category_s:"main"
    }})

console.log(result)

Thanks!!!
Adding the await command did the trick!