Can a New-UDLink go inside a New-UDTable column?

Hi, I know I am asking bunch of questions. Sorry about that. Trying to get a couple dashboards knocked out so I can show our team how useful PSU can be.

Can a New-UDLink go inside a table column? I seem to be able to place text in the table column but not a New-UDLink

        'CI'              = (New-UDLink -url $ciUrl -Text $ciVersion)
        'QA'              = $qaVersion
        'RC'              = $rcVersion 

$Columns = @('ApplicationName', 'CI', 'QA', 'RC', 'HF', 'QC', 'BETA', 'BLUE', 'GREEN') | ForEach-Object {
   New-UDTableColumn -Property $_ -Title $_ 
$gridapp = New-UDTable -Id 'gridapp' -Title "Release Information" -PageSize 40 -Columns $Columns -Data ($CacheDatalist | Where-Object -Property 'Type' -EQ "Application")

when i use the New-UDLink i get this error on the dashboard

I think you will need to use the -render property of new-udtablecolumn

1 Like

Thanks, I am a little confused on when that -Render can be done.

I am defining some columns initially and passing the $Column array to New-UDTable where I have the data.

I guess I would have to assign the data during the column init timeframe?

$Columns = @(
   New-UDTableColumn -Property 'ApplicationName' -Title 'ApplicationName' -Width 5
   New-UDTableColumn -Property 'CI' -Title 'CI'  -Render (New-UDLink -url $URL -Text $Text)
   New-UDTableColumn -Property 'QA' -Title 'QA'  -Render (New-UDLink -url $URL -Text $Text)

$gridapp = New-UDTable -Id 'gridapp' -Title "Release Information" -PageSize 40 -Columns $Columns -Data ($CacheDatalist | Where-Object -Property 'Type' -EQ "Application")

I have something like this and this works for me:

New-UDTableColumn -Property "Name" -Render {
  New-Udlink -Text $EventData.Name -Url $EventData.Url -OpenInNewWindow

(I use EventData to retrieve the Name and Url that are part of the table)

Thanks, Is $Eventdata a variable that you created and loaded up?

I have a CacheDatalist variable that has a ciURL and CI amonst other things,defined

$CacheDatalist = [System.Collections.Generic.List[pscustomobject]]::new()

I tried this and it didnt work even though i know $CacheDatalist.CI and $CacheDatalist.ciURL has the text and url arrays as i can run that part of the code in powershell command prompt.

New-UDTableColumn -Property ‘CI’ -Title ‘CI’ -Render {New-Udlink -Text $CacheDatalist.CI -Url $CacheDatalist.ciURL}

and get this error and no data in the CI column

tartup: Cannot process argument transformation on parameter 'Text'. Cannot convert value to type System.String.
Startup: at <ScriptBlock>, C:\ProgramData\UniversalAutomation\Repository\dashboards\version\version.ps1: line 231
at New-UDTable<Process>, C:\ProgramData\PowerShellUniversal\Server\Modules\UniversalDashboard\4.1.0\UniversalDashboard.MaterialUI.psm1: line 5780
at <ScriptBlock>, C:\ProgramData\UniversalAutomation\Repository\dashboards\version\version.ps1: line 241
at <ScriptBlock>, <No file>: line 1
Startup:    at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
   at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
   at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32 parameterSets, Collection`1 arguments)
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
   at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
   at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
   at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
   at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
   at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)

I also tried this.

New-UDTableColumn -Property ‘CI’ -Title ‘CI’ -Render {New-Udlink -Text $EventData.CI -Url $EventData.ciURL}

no errors but no data in the CI column

$EventData is a special variable created by Powershell Universal

Basically with New-UDTable the data passed to it becomes available in $EventData, so you need the data available in the inital data you put in New-UDTable.

I don’t have access to a system where I am currently, but look at the docs here: Table - PowerShell Universal See the example with $EventData