Table: Display button if data is null

Request from network admin that I can’t seem to wrap head around if even possible.

Have table with 5 columns: Issue (btn), Name, Password, Note, Send Email (btn)

Request is to remove issue column and instead have btn in Password column only if password data -eq “Not Set”.

Current Table code

New-UDCard -Title 'Account Table' -Content { 
                            $Columns = @(
                                    New-UDTableColumn -Property Issue -Title Issue -Sort $false -Render { 
                                            New-UDButton -Id "btn$($EventData)" -Text "Issue" -OnClick { 
                                                Show-UDToast -Message "Issuing password for $($EventData.name) requested by $user" -Duration 4000 -Position center -ID 'Executing'
                                                $Credentials = Invoke-UAScript -Script $SetScript -Identity $EventData.name -User $User -Wait
                                                Show-UDToast -Message "Password issued for $($EventData.name).  Use Send Email to receive email to forward to desired guest.
                                                    " -Duration 4000 -Position center
                                            Sync-UDElement -Id 'AccountTable'
                                            } 
                                        }
                                    New-UDTableColumn -Property Name -Title "Account" -Sort $True
                                    New-UDTableColumn -Property idautoPersonDefaultPassword -Title "Password" -Sort $True
                                    New-UDTableColumn -Property info -Title "Note(s)" -Sort $True
                                    New-UDTableColumn -Property Email -Title Email -Sort $false -Render {
                                            New-UDButton -Id "btn$($EventData)" -Text "Send Email" -OnClick { 
                                                Show-UDToast -Message "Sending Email"-Duration 4000 -Position center
                                                Invoke-UAScript -Script $SendSabersEvent -Identity $User -TenantID $365TenantID -AppID $TechNoticeAppID -AppSecret $TechNoticeAppSecret -SEAccount $EventData.Name
                                            } 
                                        }
                                )
                            New-UDTable -Id 'Table' -Data $FilteredData -Columns $Columns -ShowSort
                            } -Elevation 2
                    }

Product: PowerShell Universal
Version: 2.8.2

You should be able to do a if/else statement inside the -Render for the password column, if data -eq “not set” {New-UDButton} else {"$($EventData.idautoPersonDefaultPassword)"}
I do something similar for M365 accounts that are synced with onPrem Active Directory.

I’m on my phone but udtable support -hidden now.
So you can do if/else and use -Hidden

RamonMA,

Thanks that worked perfectly.

image