From 932d530fbc0d84e43b8e81303a23b6110f0932c6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Sat, 29 Jun 2024 20:09:26 +0200 Subject: [PATCH] Small improvement around naming of columns --- Public/Objects/Format-TransposeTable.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Public/Objects/Format-TransposeTable.ps1 b/Public/Objects/Format-TransposeTable.ps1 index 1d74e34..3d39060 100644 --- a/Public/Objects/Format-TransposeTable.ps1 +++ b/Public/Objects/Format-TransposeTable.ps1 @@ -76,7 +76,10 @@ function Format-TransposeTable { [switch] $Legacy, [Parameter(ParameterSetName = 'Pivot')] - [string] $Property + [string] $Property, + + [Parameter(ParameterSetName = 'Pivot')] + [string] $Name = "Object " ) begin { $Object = [System.Collections.Generic.List[object]]::new() @@ -98,7 +101,7 @@ function Format-TransposeTable { } } else { for ($i = 0; $i -lt $Object.Count; $i++) { - $ListHeader.Add("Object $i") + $ListHeader.Add("$($Name)$i") } } $CountOfProperties = $Object[0].GetEnumerator().Name.Count @@ -130,7 +133,7 @@ function Format-TransposeTable { } } else { for ($i = 0; $i -lt $Object.Count; $i++) { - $ListHeader.Add("Object $i") + $ListHeader.Add("$($Name)$i") } } $CountOfProperties = $Object[0].PSObject.Properties.Name.Count