Powershell - DataRow to an Array -


i have result of sql query looks 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 date : 29/09/2015 00:00:00 ls   : c-am1 tco  : 8059 fco  : 0 

i need array thus:

$data = @" date, ls, tco, fco [the contents of $result1 object goes here under relevant headings] [example] 29/09/2015,c-am1,8059,0 29/09/2015,c-am2,5985,3 "@ 

this can pass 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 easy way this, can't find it. how can this?

you want put data array show example of data in string. if doing follow example on link convertto-advhtml unnecessary step because have array of objects in result1. need this;

$html = $result1 | convertto-advhtml 

you need add above code switches convertto-advhtml. first step in example link author show self contained example.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -