Accessing Sub-Property with New-UDTableColumn

How can New-UDTableColumn access a subproperty of an object that I’m passing to it? Here is what I have:

New-UDTableColumn -Property status.name -Title "Status"

I’ve tried different variations for the Property parameter but cannot get it to display the string at Status.Name.

I feel like this is easy but I just cannot figure it out.

Product: PowerShell Universal
Version: 1.4.6

This won’t work but you can use the -Render property to display it.

New-UDTableColumn -Property status.name -Title "Status" -Render { 
   $EventData.Status.Name
}

That was the key!

Thanks for the help! I knew it’d be simple.

Okay so I tried applying this to another instance where the value I’m trying to display is contained within an array of several objects. I can’t easily access it with dot notation (status.name) so the code is a little different:

New-UDTableColumn -Property customFields -Title "Eddy" -Render { ($EventData.customfields | Where-object {$_.id -eq 62}).value }

But I’m not getting an output. Does the -Property parameter play a role here or am I over-extending -Render?

The property doesn’t really matter when using render. If you want to see what the value of your $EventData looks like, I recommend outputting that to see why this particular script block isn’t executing as expected. Coverting it to JSON might be helpful.

New-UDTableColumn -Property customFields -Title "Eddy" -Render { ($EventData.customfields | Where-object {$_.id -eq 62}) | ConvertTo-Json }

New-UDTableColumn -Property customFields -Title "Eddy" -Render { ($EventData.customfields  | ConvertTo-Json }