Jannat Arora
Jannat Arora

Reputation: 2989

Comparison in UDF in Kusto on tabular data

I am trying to take the table in Kusto and apply a user defined function to individual columns. In the query below: I take two columns from a table of type JSON and am comparing them for equality.

let MyFilter = (X:(x:dynamic, y:dynamic)) {
    X |  where isnotempty(tostring(x[0].key)) and isnotempty(tostring(y[0].key)) and x[0].key == y[0].key ;
};
tabl
| where MyFilter(ObjJson,ObjJson1) == true

However, this code does not seem to work. Can someone please help with this?

Upvotes: 0

Views: 763

Answers (1)

Yoni L.
Yoni L.

Reputation: 25905

try using the invoke operator: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/invokeoperator

let MyFilter = (X:(x:dynamic, y:dynamic)) {
    X
    | where isnotempty(tostring(x[0].key)) and 
            isnotempty(tostring(y[0].key)) and 
            tostring(x[0].key) == tostring(y[0].key)
};
table
| invoke MyFilter()

Upvotes: 1

Related Questions