如何在物联网中心路由查询中使用IN子句 [英] How to use IN clause in iot hub route query
问题描述
以下查询在路由查询中不起作用: $ body.Weather.Temperature in ['30','50']
The following query is not working in route query: $body.Weather.Temperature in ['30','50']
我检查了文档,语法看起来正确.
I checked the documentation and the syntax looks right.
推荐答案
IN 和 NIN (不在)运算符,用于检查项目是否存在在数组常量中,例如['wired', 'wifi']
.
IN and NIN (not in) operator it used to check the item is or isn't in the array constants like ['wired', 'wifi']
.
对于您的情况,您需要像这样使用比较运算符:>=
和<=
:
For your case, you need use Comparison operator: >=
and <=
like this:
$body.Weather.Temperature >= 30 AND $body.Weather.Temperature <= 50
有关详细信息,您可以参考用于设备孪生,作业和消息路由的IoT中心查询语言" .
For detailed information you can reference "IoT Hub query language for device twins, jobs, and message routing".
更新:
要选择30/50的确切值,您可以使用以下查询字符串作为解决方法.
For selecting the exact value 30/50 you can use the following query string as a workaround.
$body.Weather.Temperature = 30 OR $body.Weather.Temperature = 50
这篇关于如何在物联网中心路由查询中使用IN子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!