I have an array of objects that is not returning data as expected when I try to filter it.
Data:
Date Batch
---- -----
04/08/2008 1
04/08/2008 2
04/08/2008 3
04/08/2008 10
04/08/2008 11
My code:
$table = @{}
$table = import-csv e:\report.csv
Foreach($item in $table.GetEnumerator())
{
If (($item.date -eq '4/8/2008') -and ($item.batch -le 100) )
{
$item
}
}
I would expect it to return all items but I only get:
Date Batch
---- -----
04/08/2008 1
04/08/2008 10
What am I missing?
[int]$item.batch -le 100. The alternative is let the left-hand side be the data type you want -->100 -ge $item.batch