![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Creating files from Data Table i have an interesting need and one that i am almost there with but can't get the last bit. i am querying the database to get a results set. Within the resultset, there are multiple rows within a group (in other words, if i perform a groupby i see that there are multiple rows per group). I want to take the contents from this and make a new file for each group name and place the contents of the rows into the file. So in essense i want to create a union all statement into a file. Here is what i have thus far $dt | %{ni -itemType File $_.Item(0) -value $_.Item(1)} This takes each item and creates the file and then stuffs the contents. So i have something that works but it tries to create the same file over for the rows which have identical names. I have tried this $dt | ft sqltext -group Column1 | %{ni -itemType File $_.Item(0) -value $_.Item(1) -whatif} but since it is using the FT i don't get the contents. i have also tried $dt | group column1 | %{ni -Type File $_.Name -value $_.Values} but that doesn't quite work either. How can i get the contents of each item to write into the file per group? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Creating files from Data Table I solved this soon after i posted it. I guess persistance kicked in for me (and the fact that i just had a Mocha with 4 shots of espresso) $dt | group Column1 | %{ni -type File $_.Name -value ( $_.Group | %{$_.SQLText})} "Shadow" wrote: > i have an interesting need and one that i am almost there with but can't get > the last bit. > i am querying the database to get a results set. Within the resultset, > there are multiple rows within a group (in other words, if i perform a > groupby i see that there are multiple rows per group). I want to take the > contents from this and make a new file for each group name and place the > contents of the rows into the file. So in essense i want to create a union > all statement into a file. > > Here is what i have thus far > $dt | %{ni -itemType File $_.Item(0) -value $_.Item(1)} > > This takes each item and creates the file and then stuffs the contents. So > i have something that works but it tries to create the same file over for the > rows which have identical names. > > I have tried this > $dt | ft sqltext -group Column1 | %{ni -itemType File $_.Item(0) -value > $_.Item(1) -whatif} > but since it is using the FT i don't get the contents. > i have also tried > $dt | group column1 | %{ni -Type File $_.Name -value $_.Values} > but that doesn't quite work either. > > How can i get the contents of each item to write into the file per group? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| HTA file - display data from DB records in table like ASP - how? | VB Script | |||
| Goofed up GPT partition table... Data Lost? | Vista General | |||
| Goofed up GPT partition table... Data Lost? | Vista file management | |||
| Goofed up GPT partition table... Data Lost? | Vista hardware & devices | |||
| Adding data to a hash table | PowerShell | |||