Variable Questions

This topic contains 1 reply, has 1 voice, and was last updated by  Lery 4 years, 1 month ago.

  • Author
    Posts
  • #8423

    Lery
    Participant

    Here is my code:

    
    [xml]$a = get-content c:\file.xml
    
    

    Using the above code, I can now select specific parts of that xml file.  I do this as follows:

    $a.books.author.name

    That gives me a list of everything from the name tag.

    Now I can do this

    $a.books.author.date

    Obviously that gives me everything in the date tag.

    I need to combine these together so that I can pipe them to out-gridview using the -multi parameter.  When the end user clicks on a row in out-gridview, I'm going to need to do something with just part of that selection.  So for example, out-gridview would open and show a Name column and a Date column.  The end user would click on a row and then click on OK.  When they click OK, I need to take $a.books.author.date for the row they selected and for now just output it to the console with write-host.

    I'm stuck on how to do this.

  • #8424

    Lery
    Participant

    Looks like I had to walk away from the computer and come back to it.  So for anyone else that might be having an encounter with the brain lapse, here is the code.

    [xml]=$a get-content c:\file.xml

    $a.books.author | select name,date

     

You must be logged in to reply to this topic.