crni
December 17, 2020, 10:29am
1
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
adam
December 17, 2020, 2:35pm
2
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
irortiz
January 26, 2021, 1:44pm
11
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