I'm wondering how one would sort a column of decimal or currency values numerically in show-listview?
A contrived example:
$decimalArray = 1.1, 2.2, 3.3, 10.0, 20.0, 30.0
$props = @{
Title = "Decimal Sorting"
InfoTitle = "Decimal Sorting"
InfoDescription = "Decimal Sorting"
PageSize = 100000
}
$decimalArray | Show-ListView @props -Property @{Label = "Decimals"; Expression={$_}},
@{Label = "Currency"; Expression={"{0:c}" -f $_}},
@{Label = "Number"; Expression={"{0:n0}" -f $_}}
Close-Window
In the example above:
- The first column is a decimal
- The second column is currency
- The third column is an integer
Only the integer sorts numerically. It seems as soon as a decimal or currency symbol is added to the value, ListView treats the data as a string.
Might I sort decimals and currency numerically?
Thank you, vic