Forum Discussion
Deleted
Dec 22, 2017Using Lambda to Extend Table
I'm trying to move some logic out of the main query into a lambda so the main query is easier to read.
So I want to take logic like this:
```
T //columns: operation_Name
| extend path_Label = iif(operation_Name == '/', 'home', 'other')
//end up with columns: operation_Name, path_Label
```
And I'd like to move the `iif` logic into a lambda:
```
let translate_path = (operation_Name: string)
{
iif(operation_Name == '/', 'home', 'other')
};
T //columns: operation_Name
| extend path_Label = invoke translate_path(operation_Name)
```
Also tried:
```
let translate_path = (T:(operation_Name: string))`
{
T | extend path_Label = iif(operation_Name == '/', 'home', 'other')
};
T //columns: operation_Name
| invoke translate_path()
```
- Meir_Mendelovich
Microsoft
Hi,
The following query is working for me:
let translate_path = (operation_Name:string)
{
iif(operation_Name == '/', 'home', 'other')
};
AzureActivity
| take 10
| extend path_Label = translate_path(OperationName)Hope it helps,
Meir
- Meir_Mendelovich
Microsoft
You can try this in the demo portal