$NameMatches = $Prices | Where-Object 'name' -EQ $sub.OfferName
$TermMatches = $NameMatches | where-object 'itemCode' -match $Term
$BillingFreqMatches = $TermMatches | where-object 'ItemCode' -match $BillingFreq
These 3 lines work, but any syntax I use to put them on one line returns no results.
CodePudding user response:
Seems like you're looking for this:
$Prices | Where-Object {
$_.Name -eq $sub.OfferName -and $_.itemCode -match $Term -and $_.itemCode -match $BillingFreq
}
Note that you cannot use Comparison Statement when doing multiple conditions, you must use Script block. See Description section from the Cmdlet's MS Docs.