Using EventData with New-UDTable in New-UDTableColumn

Product: PowerShell Universal
Version: 3.7.9

Does any know of a solution for obtaining the row data without selecting the row, as I am using the checkbox for another purpose? The code in the screenshot works only if I select the checkbox. I need to be able to simply click the button without having to select the checkbox. Appreciate any help!


It appears that using OnRowExpand could be a practical solution. However, I am unable to execute a SQL command or receive any results within OnRowExpand. Is there something I’m overlooking? I’ve commented out line 59 and removed {2} as it was null and throwing an error, and I’ve even imported the module again and reestablished the connection.


i am using somethink like this:

-OnRowExpand {
    New-UDDynamic -Content {
        $ColumnsPSRAuftragschrittKonfigSRVTab = @(
            New-UDTableColumn -Property "SCOMAgent"
            New-UDTableColumn -Property "Start"
            New-UDTableColumn -Property "End"
            New-UDTableColumn -Property "Time"
            New-UDTableColumn -Property "JobData" -Title "Action" -Render { 
                New-UDButton -Text "Action" -OnClick { Show-UDToast -Message "Data: $($EventData | Select-Object -Property * -ExcludeProperty renderedjobdata | ConvertTo-Json)" } 
        try { $Start = Get-Date $EventData.Start -Format "HH:mm" } catch { $Start = $EventData.Start }
        try { $End = Get-Date $EventData.End -Format "HH:mm" } catch { $End = $EventData.End }
        New-UDDynamic -Content { 
            $Time = Get-Date -Format "HH:mm:ss"
            $Data = @()
            foreach ($i in $Session:Schaltzentrale.PSRAuftragKonfigServerListe | Where-Object { $_.AKID -eq $EventData.AKID }) {
                $SCOMAgent = if (![string]::IsNullOrEmpty($i.VSA)) { $i.VSA } else { $i.SCOMAgent }
                $JobData = $EventData | Where-Object { $_.AKID -eq $i.AKID } | Select-Object ID, AWID, AKID, PlanID, Bezeichnung
                $Data += [pscustomobject]@{SCOMAgent = $SCOMAgent ; Start = $Start ; End = $End ; Time = $Time ; JobData = $JobData }
            #Show-UDToast -Message "Tab: $($Data| ConvertTo-Json)" -Duration 6789
            New-UDPaper -content {
                New-UDTable -Id 'PSRAuftragschrittKonfigSRVTab' -Data $Data -Columns $ColumnsPSRAuftragschrittKonfigSRVTab -Dense 
            } -Elevation 1 -Style @{ backgroundColor = $PaperBackgroud }
        } -AutoRefresh -AutoRefreshInterval 5

I hope loading a modul in the onrowexpand isnt necessary… :wink:
i use a API for all SQL querys but i think sql querys and api calls shoud work in the onrowexpand. perhaps the uddynamic is necessary…

1 Like

@Daniel Thank you for your reply. I am curious what your command you are using -OnRowExpand ?

??? UDTable :slight_smile:
there is an udtable with rows and on row expand the is another udtable

Ah okay table in table… great idea thx.

Worked terrific. Thank you. I do seem to have to connect inside the UDDynamic each time as the connection is closed at the end of the page (which makes sense.)