title: Adding a calculated field to a Query at run time
body: <p>I'm getting data using a query in Delphi, and would like to add a calculated field to the query before it runs.  The calculated field is using values in code as well as the query so I can't just calculate it in SQL.</p>
  
  <p>I know I can attach an <code>OnCalcFields</code> Event to actually make the calculation, but the problem is after adding the calculated field there are no other fields in the query...</p>
  
  <p>I did some digging and found that all of the field defs are created but the actual fields are only created </p>
  
  <pre><code>if DefaultFields then
      CreateFields
  </code></pre>
  
  <p>Default Fields is specified </p>
  
  <pre><code>procedure TDataSet.DoInternalOpen;
  begin
      FDefaultFields := FieldCount = 0;
      ...
  end;
  </code></pre>
  
  <p>Which would indicate that if you add fields you only get the fields you added.</p>
  
  <p>I would like all the fields in the query AS WELL AS the ones I Add.</p>
  
  <p>Is this possible or do I have to add all the fields I'm using as well?</p>