Hello folks, @adam
Problem is similar to described here:
i need to dynamically create columns for udtable with on render script block that displays green check icon for pass, red for fail and N/A for other
Data contains columns server and 10 columns from check1 to check10
This does not work - shows N/A everywhere
$columns = @(
New-UDTableColumn -Property Server -Title “Server”
(1..10 | ForEach-Object {
$check_n = “Check$_”
New-UDTableColumn -Property “$check_n” -Title “$check_n” -OnRender {
if ($EventData -eq “PASS”) { New-UDIcon -Icon check -Color green -Size sm }
elseif ($EventData -eq “FAIL”) { New-UDIcon -Icon times -Color red -Size sm }
else { New-UDTypography “N/A”
}
}
}
)
)
and using this [ScriptBlock]::Create approach also is not possible because i want to utilize udiconbutton for onclick script blocks.
and coding it in this format will be nightmare.
any working solutions ? AI chats are not very helpful..
thats because you cannot match $EventData with a string like “PASS” because $EventData is a PSCustomObject of the concurrent Row so you need to identify the indentifier before.
Something like this should work for you:
Edit:
The example above only works with one column named “CheckXXX”.
Here is a example of a working set of Servers with 10 checks, also you need to use -LoadRows in New-UDTable to get $EventData.$Property to work