将日期设置为数据查询中的局部变量 - "No tabular expression statement found"
Setting date to local variable from data query - "No tabular expression statement found"
我无法将查询中的标量日期值设置为局部变量。我收到以下错误:
SYNTAX ERROR
No tabular expression statement found
查询:
let startTime = toscalar(customMetrics
| where timestamp > ago(1d)
| summarize min(timestamp));
当 运行 只是查询时,我得到的结果很好:
我做错了什么?
你需要用这个函数执行一个statement/query,否则它只是一个不会被调用的函数定义。最简单的是打印命令,但您也可以在某些查询中调用该函数:
let startTime = toscalar(customMetrics
| where timestamp > ago(10m)
| summarize min(timestamp));
print startTime
我无法将查询中的标量日期值设置为局部变量。我收到以下错误:
SYNTAX ERROR
No tabular expression statement found
查询:
let startTime = toscalar(customMetrics
| where timestamp > ago(1d)
| summarize min(timestamp));
当 运行 只是查询时,我得到的结果很好:
我做错了什么?
你需要用这个函数执行一个statement/query,否则它只是一个不会被调用的函数定义。最简单的是打印命令,但您也可以在某些查询中调用该函数:
let startTime = toscalar(customMetrics
| where timestamp > ago(10m)
| summarize min(timestamp));
print startTime