How to use IN clause in iot hub route query

2019-08-21 02:44发布

The following query is not working in route query: $body.Weather.Temperature in ['30','50']

enter image description here

I checked the documentation and the syntax looks right.

1条回答
迷人小祖宗
2楼-- · 2019-08-21 03:08

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

For detailed information you can reference "IoT Hub query language for device twins, jobs, and message routing".

Update:

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

查看更多
登录 后发表回答