Reputation: 123
How do I check for a ProductLine whether 2 fields exactly match with 2 fields in dynTable? Condition: IF PName matches with Name AND IF Cat matches with Category in dynTable
So basically we need to iterate through the items of dynTable with information from a table called ProductLine.
| PName | Cat | Info
----------------------
| A | X | 123
| B | Y | 456
| C | Z | 789
----------------------
let dynTable =
print myDynamicValue = dynamic(
[
{
"Name": "X",
"Category": "Y"
},
{
"Name": "A",
"Category": "B"
},
{
"Name": "A",
"Category": B"
}
])
| mvexpand myDynamicValue
| evaluate bag_unpack(myDynamicValue);
dynTable
Upvotes: 0
Views: 4976
Reputation: 25905
you could use the join
operator to join on both columns: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/joinoperator?pivots=azuredataexplorer
datatable(Name:string, Category:string)
[
"X", "Y",
"A", "B",
"A", "B",
]
| join (datatable(PName:string, Cat:string, Info:string)
[
'A', 'X', 123,
'B', 'Y', 456,
'C', 'Z', 789,
]) on $left.Name == $right.PName and $left.Category == $right.Cat
Upvotes: 2