有人能向我解释为什么联合查询可以访问orderRef变量,而orderId不能访问吗?运行整个查询会显示一条错误消息"'其中"operator:未能解析名为"orderId"的标量表达式">
**我知道第二个let分配的工作方式就像我在前两个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;
toscalar((
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);