I have the result of a SQL query which looks like this:
$result1 | get-member
TypeName: System.Data.DataRow
Name MemberType Definition
---- ---------- ----------
. . .
DATE Property System.DateTime DATE {get;set;}
FCO Property System.String FCO {get;set;}
LS Property System.String LS {get;set;}
TCO Property System.UInt32 TCO {get;set;}
$result1
#multiple lines similar to this
DATE : 29/09/2015 00:00:00
LS : c-am1
TCO : 8059
FCO : 0
I need to get this into an array thus:
$Data = @"
Date, LS, TCO, FCO
[the contents of the $result1 object goes here under the relevant headings]
[example]
29/09/2015,c-am1,8059,0
29/09/2015,c-am2,5985,3
"@
This is so I can pass it to the ConvertTo-AdvHTML function https://community.spiceworks.com/scripts/show/2448-create-advanced-html-tables-in-powershell-convertto-advhtml
$Data = $Data | ConvertFrom-Csv
$HTML = $Data | ConvertTo-AdvHTML
I'm sure there is an easy way to do this, but can't find it. How can I do this?
$Dataexample isn't an array, it's a herestring.