声明标量和表格变量,只有 1 个在较低的查询中被识别
Declare scalar and tabular variables, only 1 being recognised in lower query
有人可以向我解释为什么联合查询可以访问 orderRef 变量,而 orderId 不能吗? 运行 整个查询给出错误消息 "'where' operator: Failed to resolve scalar expression named 'orderId'"
** 我知道第二个 let 赋值就像我在第一个 2 个 let 赋值后立即使用 orderId 语句执行 orderId 一样,我将获得我想要的 orderId在最终联合查询中使用。
// <config>
let orderRef = "ABCDEF";
// </config>
// get orderId
let orderId = app('my-function').traces
| where message has orderRef
| order by timestamp asc
| extend msg=parse_json(substring(message, 6, strlen(message)))
| project msg.OrderId;
union *,
app('my-function').traces,
app('my-function2').traces,
app('my-function3').traces,
| where message has orderRef or message has orderId
| project timestamp, cloud_RoleName, operation_Name, message;
let orderId = toscalar(app('my-function').traces
| where message has orderRef
| order by timestamp asc
| extend msg=parse_json(substring(message, 6, strlen(message)))
| project msg.OrderId);
有人可以向我解释为什么联合查询可以访问 orderRef 变量,而 orderId 不能吗? 运行 整个查询给出错误消息 "'where' operator: Failed to resolve scalar expression named 'orderId'"
** 我知道第二个 let 赋值就像我在第一个 2 个 let 赋值后立即使用 orderId 语句执行 orderId 一样,我将获得我想要的 orderId在最终联合查询中使用。
// <config>
let orderRef = "ABCDEF";
// </config>
// get orderId
let orderId = app('my-function').traces
| where message has orderRef
| order by timestamp asc
| extend msg=parse_json(substring(message, 6, strlen(message)))
| project msg.OrderId;
union *,
app('my-function').traces,
app('my-function2').traces,
app('my-function3').traces,
| where message has orderRef or message has orderId
| project timestamp, cloud_RoleName, operation_Name, message;
let orderId = toscalar(app('my-function').traces
| where message has orderRef
| order by timestamp asc
| extend msg=parse_json(substring(message, 6, strlen(message)))
| project msg.OrderId);