动态选择要过滤的列
Dynamically choose column to filter on
我正在尝试从编译时未知的 table 动态创建查询和过滤器(具体来说,如果我正在查询 [=12],我想在 id
上进行过滤=] table, operation_ParentId
否则)。以下失败,因为 id
不是 exceptions
table 中的列:
let dataset = exceptions;
dataset
| where (itemType == "request" and id == "test") or (itemType != "request" and operation_ParentId == "test")
提前致谢!
这可以使用 columnifexists()
:
let dataset = exceptions;
dataset
| where (itemType == "request" and columnifexists("id", operation_ParentId) == "test") or (itemType != "request" and operation_ParentId == "test")
您可以“联合”两个表:
let dataset = union exceptions, requests;
...
我正在尝试从编译时未知的 table 动态创建查询和过滤器(具体来说,如果我正在查询 [=12],我想在 id
上进行过滤=] table, operation_ParentId
否则)。以下失败,因为 id
不是 exceptions
table 中的列:
let dataset = exceptions;
dataset
| where (itemType == "request" and id == "test") or (itemType != "request" and operation_ParentId == "test")
提前致谢!
这可以使用 columnifexists()
:
let dataset = exceptions;
dataset
| where (itemType == "request" and columnifexists("id", operation_ParentId) == "test") or (itemType != "request" and operation_ParentId == "test")
您可以“联合”两个表:
let dataset = union exceptions, requests;
...