Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-UDTable - Server-side processing not working with PSCustomObject #109

Closed
adamdriscoll opened this issue Apr 5, 2021 · 1 comment
Closed
Labels
bug Something isn't working completed The issue has been completed but is not yet released. PowerShell Universal Issue relates to PowerShell Universal.

Comments

@adamdriscoll
Copy link
Member

Describe the bug

An error is shown when attempting to use server-side processing (-LoadData) with PSCustomObjects.

To Reproduce

$Columns = @(
    New-UDTableColumn -Property dessert -Title "A Dessert"
    New-UDTableColumn -Property calories -Title Calories 
    New-UDTableColumn -Property Fat -Title Fat 
    New-UDTableColumn -Property Carbs -Title Carbs 
    New-UDTableColumn -Property Protein -Title Protein 
)

New-UDTable -Columns $Columns -LoadData {
    $Query = $Body | ConvertFrom-Json

    $Data = @(
        [PSCustomObject]@{Dessert = 'Frozen yoghurt'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
        [PSCustomObject]@{Dessert = 'Ice cream sandwich'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
        [PSCustomObject]@{Dessert = 'Eclair'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
        [PSCustomObject]@{Dessert = 'Cupcake'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
        [PSCustomObject]@{Dessert = 'Gingerbread'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
    )

    $data | Out-UDTableData -Page 0 -TotalCount 5 -Properties $Query.Properties
}

This same thing works with hashtables.

$Columns = @(
    New-UDTableColumn -Property dessert -Title "A Dessert"
    New-UDTableColumn -Property calories -Title Calories 
    New-UDTableColumn -Property Fat -Title Fat 
    New-UDTableColumn -Property Carbs -Title Carbs 
    New-UDTableColumn -Property Protein -Title Protein 
)

New-UDTable -Columns $Columns -LoadData {
    $Query = $Body | ConvertFrom-Json

    $Data = @(
@{Dessert = 'Frozen yoghurt'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Ice cream sandwich'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Eclair'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Cupcake'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
@{Dessert = 'Gingerbread'; Calories = (Get-Random); Fat = 6.0; Carbs = 24; Protein = 4.0}
    )

    $data | Out-UDTableData -Page 0 -TotalCount 5 -Properties $Query.Properties
}

Expected behavior

Table shown correctly.

Version

Version Number: 1.5.15
Dashboard Framework (if applicable): Latest
Operating System: N\A

Logs

[04-05-21 03:57:15 PM] An error occurred: Cannot bind argument to parameter ‘InputObject’ because it is null.

Endpoint: Assets
Session: 42ad9581-1004-46dd-a3b4-50727104c8af
File: C:\ProgramData\UniversalAutomation\Repository\psuniversal\UserAccount-Dashboard-ServerSide.ps1
Endpoint Start Line: 161
Endpoint End Line: 267
Stack Trace: at New-UDTable, C:\Program Files (x86)\Universal\UniversalDashboard\Frameworks\v3\UniversalDashboard.MaterialUI.psm1: line 4321
at , : line 36
at New-UDStyle, C:\Program
@adamdriscoll adamdriscoll added bug Something isn't working PowerShell Universal Issue relates to PowerShell Universal. labels Apr 5, 2021
@adamdriscoll
Copy link
Member Author

@adamdriscoll adamdriscoll added the completed The issue has been completed but is not yet released. label Jul 3, 2022
@adamdriscoll adamdriscoll closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed The issue has been completed but is not yet released. PowerShell Universal Issue relates to PowerShell Universal.
Projects
None yet
Development

No branches or pull requests

1 participant