Hello @matt71,
I hope youāre doing well.
For this expression, you can use two methods: one is using the in
operation, and the other is the or
operation.
For example, we have this JSON:
[
{
"Product Name": "Bowler Hat",
"ProductID": 858383,
"SKU": "0406654608",
"Description": {
"Colour": "Purple",
"Width": 300,
"Height": 200,
"Depth": 210,
"Weight": 0.75
},
"Price": 34.45,
"Quantity": 2
},
{
"Product Name": "Trilby hat",
"ProductID": 858236,
"SKU": "0406634348",
"Description": {
"Colour": "Orange",
"Width": 300,
"Height": 200,
"Depth": 210,
"Weight": 0.6
},
"Price": 21.67,
"Quantity": 1
},
{
"Product Name": "Fedora",
"ProductID": 858563,
"SKU": "0406781234",
"Description": {
"Colour": "Black",
"Width": 320,
"Height": 220,
"Depth": 230,
"Weight": 0.9
},
"Price": 45.99,
"Quantity": 3
},
{
"Product Name": "Top Hat",
"ProductID": 858764,
"SKU": "0406795432",
"Description": {
"Colour": "Gray",
"Width": 340,
"Height": 240,
"Depth": 250,
"Weight": 1.1
},
"Price": 56.00,
"Quantity": 4
}
]
Method 1: Using the in
operation
If you want to filter the products by names, like āBowler Hatā or āFedoraā, you can use the in
operator like this:
$[`Product Name` in ["Bowler Hat", "Fedora"]]
Method 2: Using the or
operation
Alternatively, you can use the or
operator to achieve the same result:
$[(`Product Name` = "Bowler Hat") or (`Product Name` = "Fedora")]
Both methods will filter out the desired products.
Let me know if you need further assistance!