title: Octopus output variables and accessing them
body: <p>I've octopus variables under "Library" -> "Variable Sets" variables with names</p>
  
  <pre><code>1. DatabaseExceptions
  2. ReportsExceptions
  3. ApplicationExceptions
  </code></pre>
  
  <p>And I've setup of my project "Deployment process" in octopus as steps</p>
  
  <pre><code>1. Database
  2. Reports
  3. Application
  4. Send Email
  </code></pre>
  
  <p>The above variable are set with exceptions by using 'PowerShell' scripts that are invoked using predeploy.ps1 of the particular step on exceptions in scripts.</p>
  
  <p>At the last step(Send Email) I was trying to send email with the information in exception variables by checking if particular variable has information in it.</p>
  
  <p>I'm doing this in the send Email step body by checking the check box("Body as HTML")</p>
  
  <pre><code>&lt;h2&gt;Deployment Steps&lt;/h2&gt;
  &lt;ol&gt;
      #{each step in Octopus.Step}
          #{if step.Status.Code}
              &lt;li&gt;#{step | HtmlEscape} &amp;mdash;
                  #{if Step.Name == "Database"}
                      #{if Octopus.Action[Database].Output.DatabaseExceptions}
                          &lt;pre&gt;#{Octopus.Action[Database].Output.DatabaseExceptions}&lt;/pre&gt;
                      #{/if}
                  #{/if}
                  #{if Step.Name == "Reports"}
                      #{if Octopus.Action[Reports].Output.ReportsExceptions}
                          &lt;pre&gt;#{Octopus.Action[Reports].Output.ReportsExceptions}&lt;/pre&gt;
                      #{/if}
                  #{/if}
                  #{if Step.Name == "Application"}
                      #{if Octopus.Action[Application].Output.ApplicationExceptions}
                          &lt;pre&gt;#{Octopus.Action[Application].Output.ApplicationExceptions}&lt;/pre&gt;
                      #{/if}
                  #{/if}
              &lt;/li&gt;
          #{/if}
      #{/each}
  &lt;/ol&gt;
  </code></pre>
  
  <p>The Database and Reports scripts has errors and my output looks like below which is correct as expected</p>
  
  <pre><code>Deployment Steps
  1.  Database — Exception on processing DB scripts - info:...
  2.  Reports — Exception on processing Reports - info:...
  3.  Application
  4.  Send Email
  </code></pre>
  
  <p><strong>And my Question</strong>: </p>
  
  <blockquote>
    <p>Is it possible to do something as below as my step name and starting
    of my variable name are same</p>
  </blockquote>
  
  <pre><code>&lt;h2&gt;Deployment Steps&lt;/h2&gt;
  &lt;ol&gt;
      #{each step in Octopus.Step}
          #{if step.Status.Code}
              &lt;li&gt;#{step | HtmlEscape} &amp;mdash;
                      #{if Octopus.Action[#{step.Name}].Output.#{step.Name}Exceptions}
                          &lt;pre&gt;#{Octopus.Action[#{step.Name}].Output.#{step.Name}Exceptions}&lt;/pre&gt;
                      #{/if}
              &lt;/li&gt;
          #{/if}
      #{/each}
  &lt;/ol&gt;
  </code></pre>