title: PowerShell: Appending Multiple Property Values to Array
body: <p>I am trying to append the $date variable which should contain the ticket creation date to an existing array that contains open tickets:</p>
  <pre><code>$teamConfig = @(
      [pscustomobject]@{
          TeamName  = 'Team1'
          TeamEmail = 'team1@domain.tld'
      }
      [pscustomobject]@{
          TeamName  = 'Team2'
          TeamEmail = 'team2@domain.tld'
      }
  )
  
  $query = &quot;select * from INCAutomation&quot;
  
  $results = Invoke-Sqlcmd -query $query -ServerInstance 'localhost' -Database 'AyushTest'
  
  $teamTickets = foreach($team in $teamConfig) {
    # Filter tickets based on team name
    $ticketIds = $results |Where-Object TeamName -eq $team.TeamName |Select -ExpandProperty TicketID
    $date = $results |Where-Object TeamName -eq $team.TeamName |Select -ExpandProperty createdDate
  
      # Create an empty array
      $ticketIdArray = @()
  
      foreach ($id in $ticketIds) {
          $thisId = &quot;
              &lt;tr&gt;
              &lt;td&gt;$($id)&lt;/td&gt;
              &lt;td&gt;$($date)&lt;/td&gt;
              &lt;/tr&gt;
          &quot;
          $ticketIdArray += $thisId
      }
  
  
    $team |Select TeamName,TeamEmail,@{Name='HTML';Expression={$ticketIdArray}}
  }
  
  $teamTickets.HTML
  </code></pre>
  <p>However this is the output I get (example):</p>
  <pre><code>&lt;tr&gt;
  &lt;td&gt;INC0001&lt;/td&gt;
  &lt;td&gt;10/12/20 10/12/20 10/12/20 10/12/20&lt;/td&gt;
  &lt;/tr&gt;
          
  
  &lt;tr&gt;
  &lt;td&gt;INC0002&lt;/td&gt;
  &lt;td&gt;10/12/20 10/12/20 10/12/20 10/12/20&lt;/td&gt;
  &lt;/tr&gt;
          
  &lt;tr&gt;
  &lt;td&gt;INC0003&lt;/td&gt;
  &lt;td&gt;10/12/20 10/12/20 10/12/20 10/12/20&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  <p>This is my desired output:</p>
  <pre><code>&lt;tr&gt;
  &lt;td&gt;INC0001&lt;/td&gt;
  &lt;td&gt;10/12/20&lt;/td&gt;
  &lt;/tr&gt;
          
  
  &lt;tr&gt;
  &lt;td&gt;INC0002&lt;/td&gt;
  &lt;td&gt;10/12/20&lt;/td&gt;
  &lt;/tr&gt;
          
  &lt;tr&gt;
  &lt;td&gt;INC0003&lt;/td&gt;
  &lt;td&gt;10/12/20&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  <p>It seems like for whatever reason the date is being appended based on the total number of teams.</p>
  <p>Any ideas? Thanks in advance</p>