Two function join results to 1 table

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of 37mm 37mm 10 months, 3 weeks ago.

  • Author
    Posts
  • #34056
    Profile photo of 37mm
    37mm
    Participant

    I have to function that return results in the same format. How do I join them to 1 table

    $bsparta = bing-sparta -content $path | ConvertTo-Html -Fragment 
    $bhaledon = bing-haledon -content $path  | ConvertTo-Html -Fragment
    
    PS C:\> $bsparta 
    
    Location                                     Distance In Miles                            Traffic Status                               Eta with Traffic                            
    --------                                     -----------------                            --------------                               ----------------                            
    Sparta                                       1 Miles                                      None                                         1 Minutes                                   
    
    
    
    PS C:\> $bhaledon 
    
    Location                                     Distance In Miles                            Traffic Status                               Eta with Traffic                            
    --------                                     -----------------                            --------------                               ----------------                            
    Haledon                                      52 Miles                                     Mild                                         68 Minutes                                  
    
    
  • #34057
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Since these objects all have the same set of properties, you just need to use a single pipe to ConvertTo-Html. For example:

    $bsparta = bing-sparta -content $path
    $bhaledon = bing-haledon -content $path
    
    $table = $bsparta,$bhaledon | ConvertTo-Html -Fragment
    
  • #34058
    Profile photo of 37mm
    37mm
    Participant

    Awesome thanks Dave!

You must be logged in to reply to this topic.