动态选择要过滤的列

时间:2018-03-20 00:08:06

标签: ms-app-analytics

我试图从编译时未知的表中动态创建查询和过滤器(具体来说,如果我查询id,我想在requests上过滤表,operation_ParentId否则)。以下操作失败,因为id不是exceptions表中的列:

let dataset = exceptions;
dataset
| where (itemType == "request" and id == "test") or (itemType != "request" and operation_ParentId == "test")

提前致谢!

2 个答案:

答案 0 :(得分:0)

可以使用columnifexists()

完成此操作
let dataset = exceptions;
dataset
| where (itemType == "request" and columnifexists("id", operation_ParentId) == "test") or (itemType != "request" and operation_ParentId == "test")

答案 1 :(得分:0)

你可以“联合”这两个表:

let dataset = union exceptions, requests;
...