I’m either going about this very wrong or missing something very simple
I’m trying to check a CSV file to see if a value exists, if it does i want to display a message to say it already exists otherwise say it doesn’t exist.
The issue i’m facing is it always tells me it doesn’t exist because as it loops through all the rows looking to see if the value is there, unless the value im looking for is the last entry in the CSV it always says it doesn’t exist because it ultimatley doesn’t equal the last entry.
$value = $textboxValue.Text
foreach ($row in $csv)
{
if ($row.sku -eq $value)
{
$outputrichtextboxResult.Text = "Value Exists"
}
else
{
$outputrichtextboxResult.Text = "Value Doesn't Exist"
}
}
I guess my problem is im looking at each row one at a time rather than just asking if it exists in the file as a whole but i seem i have hit a mental block on something so seamingly simple.
I have searched online and not managed to find the answer either (well i probably did and just didn’t realise ).
Any help will be greatly appreciated.
Cheers,
Jamie