This blog has moved to http://ThePowerShellGuy.com
A viewer for the dataset created in former Post, More DataTables and joining them in Monad
to Show the Relations in a Datagrid,
I did already show it here, WMI viewer script for MSH (GUI)
, but here you can see it Shows the relations created so you can walk them like this, also you can sort the Tables:
To Computer :
# DataSet Viewer Example,
# $DS should already be filled
# /\/\o\/\/ 2005
$form = new-object "System.Windows.Forms.Form"
$form.Size = new-object System.Drawing.Size @(800,400)
$DG = new-object "System.windows.forms.DataGrid"
$DG.CaptionText = "Example for http://mow001.blogspot.com/2005/12/more-datatables-and-joining-them-in.html"
$DG.AllowSorting = $True
$DG.DataSource = $Ds.mshobject.baseobject
$DG.Dock = [System.Windows.Forms.DockStyle]::Fill
#show the Form
$form.text = "DataSet Viewer Example"
$form.topmost = $true
I think this is a nice way to look at the result of your Data combining done in Monad
If you got the data in the DataSet from different sources, don't forget you can save a dataset to XML for later use, see also : Using ADO to get data from Excel to Dataset in Monad.
(If you do this for a DataTable take care that you have to save it with Schema to load it back in a DataTable Object, also you have to Name the DataTable before Saving.
Also you might want to look at the DataView Class to Filter the Data in the DataTable you would almost forget your still in a Command Shell
PS if you want to go back from computer to user just add another relation
Tags : Monad msh
# Add a relation back from Computer to User
# Watch out ! child / Parent Switched Using Variables Of last Post !
$rel = new-object System.Data.DataRelation("ComputerToUser",$child,$parent,$false)