database - Transpose or output data to row based table -
i having trouble figuring out how output row based data table in powershell. able standard columnar based data table, not other way around.
my current output looks like:
books cables pens client1 1 0 0 client2 2 4 6 client3 1 3 10
the books, cables , pens constant, , have new clients add.
i need able output table can narrow down filtering both client , item
i need have this:
client1 client2 client3 books 1 2 1 cables 0 4 3 pens 0 6 10
i use key/value pair fill in data separate object:
$ctable = foreach ($client in $clientstuff) { [pscustomobject] @{ client = $client.name books = $client.books.count cables = $client.cables.count pens = $client.pens.count } } $ctable= $ctable | format-table
need format table otherwise comes out list have 100s of clients , more 40 different items, cant hard code each.
i figured maybe use system.data.datatable if not sure how.
i have looked @ solution provided in export hashtable csv key column heading
but cant seem make work, answers not marked answering question in question. no matter how adapt it, me errors. solution not meet requirement of being filterable both item , client, turns numbered list multiple columns.
i have looked @ number of other links, again have been more lists rather parseable tables can filtered both rowname (item) , columnname (client)
preferably method output generically row based table, if not transposing fine too
Comments
Post a Comment