我需要在ekuiper rest中记录当前时间,时间格式为 ```
2024-04-12 11:44
SELECT *,format time(time,"yyyy-MM-dd HH:mm") As dateTime1
用了这个语句然后规则中引用
{{.dateTime1}}
显示空值
<no value>
我需要在ekuiper rest中记录当前时间,时间格式为 ```
2024-04-12 11:44
SELECT *,format time(time,"yyyy-MM-dd HH:mm") As dateTime1
用了这个语句然后规则中引用
{{.dateTime1}}
显示空值
<no value>
规则中引用 {{.dateTime1}} 是指什么呢。你要不贴一下完整的规则和发送的消息吧。
规则
SELECT *,format time(time,“yyyy-MM-dd HH:mm”)As dateTime1,
CASE
WHEN TEM < 25 AND lag(TEM,1,0) OVER (PARTITION BY SN) >= 25 THEN 1
WHEN TEM > 27 AND lag(TEM,1,0) OVER (PARTITION BY SN) <= 27 THEN 1
WHEN HUM < 45 AND lag(HUM,1,0) OVER (PARTITION BY SN) >= 45 THEN 1
WHEN HUM < 45 AND lag(HUM,1,0) OVER (PARTITION BY SN) >= 45 THEN 1
END AS leval
FROM TM_713
WHERE leval != NULL
发送消息
time: {{.dateTime1}}
where 条件能通过吗,发送的消息是否包含 time 呢,可以先用 select * from TM_713 验证诊断一下。
数据中time是带秒的 2024-04-12 11:44:58
发送不能含有秒,ekuiper可以自动生成一个yyyy-MM-dd HH:mm规则的time用于发送调用吗
{
“SN”: “71308”,
“time”: “2024-04-11 21:11:41”,
“HUM”: 6,
“TEM”: 28
}
发送的消息是有time的
就是用这个,但是输出是空值
规则
select * from TM_713
Rest:{{.time}}
结果打印:2024-04-12 13:52:11
期望输出:2024-04-12 13:52
这要怎么实现呢
使用
select *,format_time(time, “YYYY-MM-dd HH:mm”) from TM_713
提示
run Select error: call func format_time error: parsing time “2024-04-12 14:34:44” as “2006-01-02T15:04:05.000Z07:00”: cannot parse " 14:34:44" as “T”