title: How to add Value from subreport in main crystal report formula
body: <p>Below Is My crystal report structure (shown in Image) ,I am using below formula to get <code>Fee Total</code></p>
  
  <pre><code>If{DataTableDoctorInfo.Fee_Unit}="Percent" Then
  formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}
  Else 
  formula={DataTableDoctorInfo.Fee}*{DataTable1.Number of Patient}* Sum ({DataTableDrmonthlyData.Payable Amount})
  End If
  </code></pre>
  
  <p>now I also want to add sub total In my formula which i am getting In my <code>subreport</code> from column having <code>sum</code> of that column values ,Now I want to use this sum in above formula something like this </p>
  
  <pre><code> formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}* {that sum value which I am getting in sub report}
  </code></pre>
  
  <p><code>DrMonthlySubRepoPatient</code> is My sub report shown in image in <code>section 3</code> ,How I can achieve this ?
  I tried this code in <code>Main report</code> formula of FeeTotal </p>
  
  <pre><code>WhilePrintingRecords;
  Shared CurrencyVar myTotal;
  myTotal :=myTotal;
  
  If{DataTableDoctorInfo.Fee_Unit}="Percent" Then
  formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}* myTotal
  Else 
  formula={DataTableDoctorInfo.Fee}*{DataTable1.Number of Patient}* Sum ({DataTableDrmonthlyData.Payable Amount})
  End If
  </code></pre>
  
  <p>and this formula in subreport fo Payble amount field</p>
  
  <pre><code>WhilePrintingRecords;
  Shared CurrencyVar myTotal := Sum ({DataTableDrmonthlyData.Payable Amount})
  </code></pre>
  
  <p>but its giving following error,How do I resolve it?</p>
  
  <pre><code>`The remaining Text does not appear to be part of the formula `
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/PBv8s.png" alt="enter image description here"></p>