Hi everyone,
I have a problem with the {{mysql_query.result__rows}}
filtering and maybe somebody knows how to fix it
I want to check in a filter after a SQL-Query, if the result rows are empty. In other syntax something like this: result.rows.length == 0
.
I tried the collection syntax like this {{mysql_query.result__rows #}} EQUALS 0
, but it didnât work. I also tried {{mysql_query.result__rows #}} IS EMPTY
AND {{mysql_query.result__rows }}
.
My idea is, that I have 2 other filters, so that my Bot can answer in a different way, based on the amount of rows.
With a little workaround, I was able to do it with an additional item
-attribute in my SQL-query, which I gave 1
as a value. The query looked like this: SELECT *,'1' as item FROM Table;
I used then in the filters the SUM to check the length of the rows:
- Multiple items found:
{{mysql_query.result__rows_+_item #}} IS GREATER THAN 1
- 1 Item found:
{{mysql_query.result__rows_+_item #}} EQUALS 1
- 0 Items found: my current problem
@FlowXO: I think the current SUM-function is only working for key-values inside arrays, but not for an array. Is there something like an array.length-function, which I havenât seen yet?
I hope you can help me, many thanks and cheerio,
Nicho