1

我正在尝试将主查询中的一些逻辑移到 lambda 中,以便主查询更易于阅读。

所以我想采取这样的逻辑:

T //columns: operation_Name
| extend path_Label = iif(operation_Name == '/', 'home', 'other')
//end up with columns: operation_Name, path_Label

我想将iif逻辑移动到 lambda 中:

let translate_path = (operation_Name: string)
{
    iif(operation_Name == '/', 'home', 'other')
};
T
| extend path_Label = invoke translate_path(operation_Name)

也试过:

let translate_path = (T:(operation_Name: string))`
{
    T | extend path_Label = iif(operation_Name == '/', 'home', 'other')
};
T
| invoke translate_path()
4

1 回答 1

1

无需添加“调用”。没有它,您的第一次尝试应该可以正常工作:

let translate_path = (operation_Name: string)
{
    iif(operation_Name == '/', 'home', 'other')
};
T
| extend path_Label = translate_path(operation_Name)
于 2018-01-23T15:17:57.757 回答