New-UDTable change in behavior

Back with another question :slight_smile:

I am pulling some old dashboards over from an old instance of UD (2.8.3 maybe?) to PSU. For the most part, even if I have to tweak here or there, they convert just fine. One that has me curious is a very simple one that took input from a CSV and fed it into a table. The CSV is a “Master Server List” for a small company, and contains properties for Server Name, Environment, OS, etc. etc. In the old UD version this worked great:

New-UDDashboard -Title "Hello, World!" -Content {
    $aMSL = import-csv -Path "<path to CSV"
    New-UDTable -Id "MSL" -Data $aMSL -Title "Master Server List" -ShowSearch -PageSize 100 -Dense
}

In the latest version it still works, but the column order is random every time it is rendered. I am just curious about the change requiring more of an ordered list or custom object? I looked through the changelog, and saw a couple of interesting entries:

1.5.8 UDv3 - Fixed an issue with New-UDTable and PSCustomObject.
1.4.6 UDv3 - Fixed an issue where PSCustomObjects would not work in New-UDTable

But couldn’t find any more info on what exactly was changed.

Edit: Just on a whim I tried to do something like this, purely to see if there would be any difference:

New-UDDashboard -Title "Hello, World!" -Content {
    $aOut = @()
    $aMSL = import-csv -Path "<path to CSV"

    $aMSL |
        % {
            $aParams = [ordered]@{
                Server = $_.Server
                ENV = $_.ENV
                OS = $_.OS
            }

        $aOut += New-Object -TypeName PSObject -Property $aParams
    }

    New-UDTable -Id "MSL" -Data $aOut -Title "Master Server List" -ShowSearch -PageSize 100
}

But unless I specify columns like below it still renders randomly every time:

New-UDDashboard -Title "Hello, World!" -Content {
    $aOut = @()
    $aMSL = import-csv -Path "<path to CSV"
    $aMSL |
        % {
            $aParams = [ordered]@{
                Server = $_.Server
                ENV = $_.ENV
                OS = $_.OS
            }
    
           $aOut += New-Object -TypeName PSObject -Property $aParams
        }

    $Columns = @(
        New-UDTableColumn -Property Server -Title Server
        New-UDTableColumn -Property ENV -Title ENV 
        New-UDTableColumn -Property OS -Title OS 
    )

    New-UDTable -Id "MSL" -Data $aOut -Title "Master Server List" -Columns $Columns -ShowSearch -PageSize 100
}

I’m mainly just curious when that ability to just pull in a CSV and work with it directly changed, seems to be more steps.

Product: PowerShell Universal
Version: 1.5.9
1 Like