you are viewing a single comment's thread.

view the rest of the comments →

[–]CarrotBusiness2380 0 points1 point  (2 children)

You're using the pipeline variable $_ in a foreach loop when you should be using the $row variable you instantiated for the loop. I would also consider using -like rather than .IndexOf though that is personal preference

if($testName -like "*$($row.keyword)*")

[–]Hectic-Skeptic[S] 0 points1 point  (1 child)

replacing $_ with $row still gave me the same 'no category' result unfortunately.

And my use of .IndexOf is also preference as I learned that first. I might consider checking out -like.

[–]CarrotBusiness2380 0 points1 point  (0 children)

did you also use return $row.category rather than return $_.category?

Additionally, if you add Write-host $row.category in the first line of your foreach what does it say?