Skip to content

Table View of [PSCustomObject] #19139

@237dmitry

Description

@237dmitry

Prerequisites

Steps to reproduce

This issue is a continuation of #19107 and #18492, which are closed as resolved. But this is not true.

The pscustomobject table representation of non-integer numbers rounds them up or down, regardless of the user's preference.

Values are rounded to two or three decimal places, depending on the System.Globalization.CultureInfo.CurrentCulture used.

For example user want to see five digits after decimal separator of property one and one digit of property two:

[pscustomobject] @{

     one = [math]::Round(0.1234567,5)
     two = [math]::Round(1.1234567,1)
     }

 one  two
 ---  ---
0.12 1.10

As you can see, the result was shocking. The user can format the output himself (as a string), but this effort looks strange.

Expected behavior

- The output values should match the user's preferences.
- The user does not have to make additional efforts to obtain the expected result.

Actual behavior

The user is forced to change the type of the resulting values and reformat their output to obtain the desired result.

Error details

It's not a bug. This is a change in the behavior of the classic table view.

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.2
PSEdition                      Core
GitCommitId                    7.3.2
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions