If math get unknown error

Hi, when I try to pass the blow I got this error

Expression failed with the message:
[if] > [math] > Unknown variable: count

filters
| essql 
  query="SELECT COUNT(*) as count FROM \"reservation-event*\" WHERE message.affiliateName='xyz' AND message.statusName='Con' AND environment.keyword='Prod' AND \"@timestamp\" > NOW() - INTERVAL 1 HOUR"
| math "count"
| if condition={math "count" | lt 1} 
  then={shape shape="rectangle" fill="red" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true} 
  else={shape shape="rectangle" fill="green" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true}

basically I am trying to make the shape red if it is less than 1 if more then green

Hi @MattiHatem.

The condition argument in the if expression will read from the current context which you've piped in with the previous math "count" line. Also, there is no "rectangle" shape type. You probably want "square". This is the list of available shapes.

I think this expression should work for you.

filters
| essql 
  query="SELECT COUNT(*) as count FROM \"reservation-event*\" WHERE message.affiliateName='xyz' AND message.statusName='Con' AND environment.keyword='Prod' AND \"@timestamp\" > NOW() - INTERVAL 1 HOUR"
| math "count"
| if condition={ lt 1 } 
  then={shape shape="square" fill="red" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true} 
  else={shape shape="square" fill="green" border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true}