title: Creating Readonly Variables in Stimulsoft
body: <p>I'm a Noobie to Stimulsoft. I have Stimulsoft Version 2015.3 running for our apps in Visual Studio 2013.</p>
  
  <p><a href="https://i.stack.imgur.com/NeT39.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NeT39.png" alt="stimulsoft"></a></p>
  
  <p>Example videos found on YouTube are all old, and I have not found any to show how to create a variable using their built-in conditional logic.</p>
  
  <p>There is a dictionary where variables are created:</p>
  
  <p><a href="https://i.stack.imgur.com/KkLdi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KkLdi.png" alt="dictionary"></a></p>
  
  <p>Currently, if I try to compile, I have 10 errors as shown here:</p>
  
  <p><a href="https://i.stack.imgur.com/ohGb0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ohGb0.png" alt="10 Errors"></a></p>
  
  <p>I'll focus on the first one: <code>decInvoiceCost</code>.</p>
  
  <p>The error says ";" expected, and gives this little preview:</p>
  
  <p><a href="https://i.stack.imgur.com/LCLVm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCLVm.png" alt="; expected"></a></p>
  
  <p>The code for it, entered using their editor, is:</p>
  
  <pre><code>{if (blnUseMarketCost) { VwInvoice.MarketCost } else { VwInvoice.AverageCost } }
  </code></pre>
  
  <p>where <code>blnUseMarketCost</code> is a Boolean, and the two (2) decimal values <code>MarketCost</code> and <code>AverageCost</code> come from the database view.</p>
  
  <p>Back in the error, if I click "Go to Code":</p>
  
  <p><a href="https://i.stack.imgur.com/HQQzz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HQQzz.png" alt="Go to Code"></a></p>
  
  <p>...I am taken to the source code which is rendered by their designer:</p>
  
  <pre><code>    public virtual decimal decInvoiceCost
      {
          get
          {
              // CheckerInfo: Value decInvoiceCost
              return {if (blnUseMarketCost) { VwInvoiceDetail.MarketCostInInvPricingUnit } else { VwInvoiceDetail.AverageCostInInvPricingUnit } }m;
          }
      }
  </code></pre>
  
  <p>I think that <strong>"m"</strong> on the end is causing some issues, but I don't really know.</p>
  
  <h2>Does anyone have a few current examples showing how to use basic logic in these variable fields?</h2>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The C# code of the report is generated by the designer. I can use it to see what the designer is trying to do, but I do not understand all of the nuances.</p>
  
  <pre><code>namespace Reports
  {
      public class Report : Stimulsoft.Report.StiReport
      {
          public Report()        {
              this.InitializeComponent();
          }
  
          #region StiReport Designer generated code - do not modify
          // 
          // {snip}
          // 
          public virtual decimal decMarkup
          {
              get
              {
                  // CheckerInfo: Value decMarkup
                  return ((decInvoiceCost==0) ? 0 : (decInvoiceProfit / decInvoiceCost))m;
              }
          }
          // 
          // {snip}
          // 
          #endregion StiReport Designer generated code - do not modify
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/elqbC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/elqbC.png" alt="Screenshot of Stimulsoft IDE"></a></p>