New-UDTable with single row

Product: PowerShell Universal
Version: 1.5.6

I have a strange problem with New-UDTable. It seems like there is a problem displaying a table with only one row.

This code is working fine:

$Data = @(
     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
     @{Dessert = 'Ice cream sandwich'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
) 
New-UDTable -Data $Data

This does not:

$Data = @(
     @{Dessert = 'Frozen yoghurt'; Calories = 159; Fat = 6.0; Carbs = 24; Protein = 4.0}
) 
New-UDTable -Data $Data

The second one display this React error:
Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=TypeError%3A%20can’t%20convert%20undefined%20to%20object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings

Definitely a bug. I’ve opened an issue for it.

1 Like

Any update to this? I’m struggling with the same thing on the Dashboard I am building. I just upgraded to 1.5.9 with the same results. Tables with 1 row do not display.

should be fixed in the latest version

can you share your code I just tested it and it does work with 1 data

$test = @{

DiskID         = '1469'

DiskLetter     = 'C:\'

TotalSpace     = '119'

FreeSpace      = '21.32'

Monitored      = 'True'

AlertThreshold = '5'

UnitofMeasure  = 'GB'

}

New-UDTable -id “Test Table” -title ‘Test Table’ -data $test

This results in the React Error:

Also tried this with the same result:

$test = @(

@{

    DiskID         = '1469'

    DiskLetter     = 'C:\'

    TotalSpace     = '119'

    FreeSpace      = '21.32'

    Monitored      = 'True'

    AlertThreshold = '5'

    UnitofMeasure  = 'GB'

}

)

if you add columns does it work ?

Same Result with this.

$diskColumns = @(

New-UDTableColumn -Property DiskID -Title "DiskID"

New-UDTableColumn -Property DiskLetter -Title "DiskLetter"

New-UDTableColumn -Property TotalSpace -Title "TotalSpace - GB"

New-UDTableColumn -Property FreeSpace -Title "FreeSpace - GB"

New-UDTableColumn -Property AlertThreshold -Title "AlertThreshold"

New-UDTableColumn -Property UnitOfMeasure -Title "UnitOfMeasure"

)

$test = @(

@{

    DiskID         = '1469'

    DiskLetter     = 'C:\'

    TotalSpace     = '119'

    FreeSpace      = '21.32'

    Monitored      = 'True'

    AlertThreshold = '5'

    UnitofMeasure  = 'GB'

}

)

New-UDTable -id “Test Table” -title ‘Test Table’ -data $test -Columns $diskColumns

will check this today
and can you download this version and check if the error persistent

Good morning @AlonGvili and @matthewy03

I’m no expert in this product yet but been using UDTable recently and was bale to display data with only one row using your example data. The one thing I did noticed, is your $Data is not properly formatted for UDTable. From what I have noticed with UDTable, it uses variable that stores data as Object. You can also use DataTable to store data if you into that.

Please see example below and screenshot:

$Data = @(
        @{DiskID = 1469; DiskLetter = 'C:\'; TotalSpace = 119; FreeSpace = 21.32; Monitored = 'True'; AlertThreshold = 5; UnitofMeasure = 'GB'}
    ) 

    $Columns = @(
        New-UDTableColumn -Property DiskID
        New-UDTableColumn -Property TotalSpace
        New-UDTableColumn -Property FreeSpace
        New-UDTableColumn -Property Monitored
        New-UDTableColumn -Property AlertThreshold
        New-UDTableColumn -Property UnitofMeasure
    )

    New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns

I hope this helps in your quest :slight_smile: