Hi, I am trying to change color of shape dynamically based on the RAG returned by my query. When the query does not return any record matching the where clause, I see an exclamation mark on the screen with error "essql failed to fetch". When no records are fetched i want the shape to default to GREY color.
code in expression editor
filters
| essql "SELECT RAG.keyword AS RAG FROM "gpm-hvp_uk_bam_watcher-dev*" where Step = '4105' order by @timestamp DESC limit 1"
| getCell column=RAG row=0
| shape "circle" fill={ switch case={case if={eq "Red"} then="RED"} case={case if={eq "Green"} then="Green"} default="Grey"} border="rgba(255,255,255,0)" borderWidth=0 maintainAspect=true
I'm not sure why you'd be getting essql failed to fetch as your error -- but one potential issue I see is that getCell column=RAG row=0 will fail if you have no results from essql.
The way around this would be to check the row count and get the cell inside the shape function itself. Something like this:
Maybe give this a shot and see if it helps? Note that I'm making the assumption that the values of RAG can safely be passed along as colors -- if they can't, you'll need to continue using a switch function as you had done originally.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.