CAM Posted June 12, 2018 Posted June 12, 2018 I have a list of staff members and their staff codes. I have managed to export it as an XML file in SIMS and used the following command to import it as an object in Powershell: [xml]$Staff = Get-Content "staffcodes.xml" Unfortunately when I run the following: $Staff.SuperStarReport.Record | Out-Gridview It is only showing the first two nodes of Forename and Surname. The third node Initials, which contains the staff code, isn't being shown because the first member of staff doesn't have that data item as they lack a staff code. I can fix this by adding in their record but this has to be done manually. Is there any way of forcing Get-Content to pick up a node even if the first record for that node is blank? I could sort it so the first staff member fills all three nodes but this isn't suitable looking forwards and handling bigger sets of data in the future.
Steve21 Posted June 12, 2018 Posted June 12, 2018 If you actually list what you want to pull out it'll show them even if blank e.g. | ft FirstName, Surname, Initials -AutoSize etcetc Steve 1
Steve21 Posted June 12, 2018 Posted June 12, 2018 So like where you did the outgrid, if you replace it with my line it should show them all in theory Steve
CAM Posted June 12, 2018 Author Posted June 12, 2018 (edited) Ahh I see it's a display problem. That works, sort of! If I try to convert it into a CSV file it still only shows the first two columns and with Format-Table it mangles the data into oblivion. And Out-Gridview just says no to wrong data type. Edited June 12, 2018 by CAM
Steve21 Posted June 12, 2018 Posted June 12, 2018 You got an example of what you're using code wise and what you want it to do? where's the CSV come into it? If you want a CSV you can do that from SIMs couldn't you? Steve
CAM Posted June 12, 2018 Author Posted June 12, 2018 I'm experimenting with a small data set with a view to using data warehousing later in the year.
Steve21 Posted June 12, 2018 Posted June 12, 2018 (edited) Not sure what you mean with the issue though, that'll scan through and list any xml whether it's got a gap or not though Example: Or isn't that what you need? -Edit - Or if you really want it view a gridview just select the properties prior to the pipe: Steve Edited June 12, 2018 by Steve21
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now