StartAutomating / EZOut

EZOut is a PowerShell module to help take the pain out of writing format and types XML
https://ezout.start-automating.com
MIT License
58 stars 8 forks source link

Example: `SelectionCondition` Multiple `TableControl` Need One Default TableRowEntry #225

Open mattcargile opened 3 weeks ago

mattcargile commented 3 weeks ago

Example

(Write-FormatTableView -Property Name,ComputerName -Width 70,25  -ViewCondition { if($_.ComputerName) { $true } } -ViewTypeName compName ) + (Write-FormatTableView -Property Name -Width 70 )  | Write-FormatView -FormatXML { $_ } -TypeName 'Utility.InstalledSoftware' | Out-FormatData | Set-Content t.format.ps1xml

Links

I'm looking at this doc. I can't quite figure out how to use the -ViewCondition. I want to display ComputerName when I have the data and hide it when I don't have the data.

mattcargile commented 3 weeks ago

I'm thinking now I need to do independent Write-FormatView with each Write-FormatTableView and then pipe into Out-FormatData.

StartAutomating commented 3 weeks ago

@mattcargile yeah, selection conditions are both overpowered and not ideally exposed yet (I've only come to realize just how overpowered they are fairly recently)

See #220

Open to thoughts on the ideal command format here.

StartAutomating commented 3 weeks ago

I want to display ComputerName when I have the data and hide it when I don't have the data.

With table formatting, this will be a little bit trickier.

Table formatting conditions require the same number of columns to exist in each possible condition.

As far as how to use the current implementation... you can pipe multiple objects with a -ViewCondition in, provided as least one has no view condition.

mattcargile commented 1 week ago

I want to display ComputerName when I have the data and hide it when I don't have the data.

With table formatting, this will be a little bit trickier.

Table formatting conditions require the same number of columns to exist in each possible condition.

As far as how to use the current implementation... you can pipe multiple objects with a -ViewCondition in, provided as least one has no view condition.

I'm seeing that now after creating a multi TableRowEntry . I'll have to do what get-process -includeusername does and create another type unfortunately like MyType.Type#ComputerName in pstypenames or the like.