title: Converting strings to DateTime in an IIF expression
body: <p>I am using SSRS 2008R2 to create reports. The datasource is xml response from webservice. I want to return empty string if there is no data, but if there is row with data I want to convert it to another datetime format.</p>
  
  <p>I am using IIF construction like this:</p>
  
  <pre><code>=IIF
  (
      LEN(Fields!DateOfReg.Value) &lt;= 0,
      "",
      FORMAT(CDATE(DateTime.ParseExact(Fields!DateOfReg.Value,"M/d/yyyy hh:mm:ss tt",
      System.Globalization.CultureInfo.InvariantCulture)), "dd.MM.yyyy HH:mm:ss")
  )
  </code></pre>
  
  <p>When there is no data it shows <strong>#Error</strong> in the textbox and in the output:</p>
  
  <blockquote>
    <p>String was not recognized as a valid DateTime</p>
  </blockquote>
  
  <p>Does it mean that the IIF construction calculates both TRUE and FALSE statements? If so how can I make it short-circuit and don't convert row if there is no data?</p>