The output of the group-object is a new object with three fields Count, Name, and Group. Count is just the number of objects in the group. Name is string from attributes you have selected (in your case “LogicalVault, MT, Generation”), and Group is the collection of all the objects meeting your grouping criteria.
So… you can select-object the output of group-object and do your calculations within the select-object.
--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ntpowershell...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bhq8%3DBbTmZGGo-y45r2d9v_%3D99yoziZEUxU9Gx%2BADiM2A%40mail.gmail.com.
The output of the group-object is a new object with three fields Count, Name, and Group. Count is just the number of objects in the group. Name is string from attributes you have selected (in your case “LogicalVault, MT, Generation”), and Group is the collection of all the objects meeting your grouping criteria.
So… you can select-object the output of group-object and do your calculations within the select-object.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/642711ffecbc44f9867a161d453240db%40smithcons.com.
The group is a collection of all the records that match the grouping criteria.
The first line says 786. So Group is a collection of 786 items (numbered 0 thru 785) containing each line of the CSV.
If you do this:
$IM_Inventory = Import-CSV -Path $InputFileName | SORT -PROPERTY LogicalVault, Media | Group-Object -Property LogicalVault, MT, Generation
$IM_Inventory[ 0 ].Group
You will get the list of the 786 records in the CSV file that matches the grouping criteria.
You access each record by an index.
$IM_Inventory[ 0 ].Group[ 0 ]
And it will contain the full CSV record at that index. Then you can just use the field name, same as any other time you use a CSV record.
$record = $IM_Inventory[ 0 ].Group[ 0 ]
$record.CustNum, $record.DateIn, etc. etc.
Just play with it. It’s pretty obvious.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2BiGFyA4XhNKUZ4WuzU63b2p8OFJLwZ44YxYRLRn%3DP73-Q%40mail.gmail.com.
The group is a collection of all the records that match the grouping criteria.
The first line says 786. So Group is a collection of 786 items (numbered 0 thru 785) containing each line of the CSV.
If you do this:
$IM_Inventory = Import-CSV -Path $InputFileName | SORT -PROPERTY LogicalVault, Media | Group-Object -Property LogicalVault, MT, Generation
$IM_Inventory[ 0 ].Group
You will get the list of the 786 records in the CSV file that matches the grouping criteria.
You access each record by an index.
$IM_Inventory[ 0 ].Group[ 0 ]
And it will contain the full CSV record at that index. Then you can just use the field name, same as any other time you use a CSV record.
$record = $IM_Inventory[ 0 ].Group[ 0 ]
$record.CustNum, $record.DateIn, etc. etc.
Just play with it. It’s pretty obvious.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/ae0d176b6de94623a18cdd5c8dcbf36d%40smithcons.com.
No, you need a report-writer for that.
Could you fake it? Sure.
Post-process $IM_Inventory_By_Date.
Do it just like you would in COBOL. 😊
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CAHBr%2B%2Bj6fhNCN6E0X-VqO8wOBuF-jHEriENWP2FzKx6QWQGWnw%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/72b51b1cfbf84390b61a1b62141d6e0f%40smithcons.com.
I learned cobol-68 and cobol-74. None of those high-falutin’ modern thing-a-ma-bobs.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce6DwwY_%2BkAk0%2BbHXTBdaUFCdZ-QoGLBQua_oU8ghd_R7Q%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/f290acc897c44103908813e83591993c%40smithcons.com.
Just Grace Hopper.
She disdained all the various distinctions she was awarded. She claimed that her work as a teacher was the most important thing she ever did.
I do find it interesting that she was the first woman to receive the “Computer Science Man-of-the-Year Award”. 😊
To view this discussion visit https://groups.google.com/d/msgid/ntpowershell/CADy1Ce5iFURe%3DOfM8RrVt0hdizNCVjNwr%2BVEubG5cwt2-PvLWQ%40mail.gmail.com.