How to include if you don't have a row = 1 on the Learn expression canvas

I have an SQL query to return some values, like: Avarege, warning, disaster, high. sometimes he returns all but sometimes he returns two of them, however I need to make a manipulation going through them all. I need a condition if it doesn't exist or doesn't create a defalt. Follows both the error and the expression

| staticColumn name="sum" value={ply expression={math "round(mean(total) - sum(seg))"} | getCell "value"}
| mapColumn name="segundo" 
  expression={if {getCell "severidade" | eq "Normalized"} then={math "sum"} else={math "seg"}}
| mapColumn name="segundopor" expression={math "round(segundo/total*100,3)"}
| staticColumn name="average" value={getCell column="segundopor" row=0}
| staticColumn name="disaster" value={getCell column="segundopor" row=1}
| staticColumn name="high" value={getCell column="segundopor" row=2 } 
| staticColumn name="normalized" value={getCell column="segundopor" row=3}
| staticColumn name="warning" value={getCell column="segundopor" row=4}
| filterrows {getCell "severidade" | eq "Normalized"}

You can have a look into this example

You need to check the rowcount before trying to do getcell

Thanks. I managed by checking the rowcount as follows

| staticColumn name="disaster" value={if {rowCount | gte 2} then={getCell column="segundopor" row=1} else=0}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.