title: Include apex variable in SOQL query
body: <p>I have a visualForce page and an apex controller. I need to get a date value from my visualForce page into my Apex Controller (this is done already) and then pass this value into my SOQL query. My SOQL query runs fine when I put an actual date value in, but when I use the variable created before it says can't find variable named x. </p>
  
  <p>I'm certain this is a general programming mistake, this is only my second week using code not clicks! </p>
  
  <p>Let me know if you want to see the VF page too. </p>
  
  <p><em><strong></em>**Apex Controller***</strong></p>
  
  <pre><code>global with sharing class GoogleChartsController2 {
      Opportunity o = new Opportunity();
      public Opportunity getProxyObject() {
          return o;
      }
  
      /**
        Loads all Opportunities and then filters 
      */
      @RemoteAction   
      global static Opportunity[] loadOpps() {
          return [select Id, Name, ExpectedRevenue, LeadSource, DaysToStartDate__c, Probability,   CloseDate, Amount from Opportunity WHERE CloseDate = :o.CloseDate ];
      }   
  }
  </code></pre>
  
  <p><em><strong></em></strong> Section from VisualForce Page <strong>*</strong></p>
  
  <pre><code>&lt;apex:page controller="GoogleChartsController2" sidebar="false"&gt; 
  &lt;!-- Google API inclusion --&gt;
  &lt;apex:includescript id="a" value="https://www.google.com/jsapi"&gt;
  
  &lt;apex:sectionheader title="Google Charts + Javascript Remoting" subtitle="Demoing - Opportunities  by Exepected Revenue"&gt;
  
  &lt;!-- Google Charts will be drawn in this DIV --&gt;
  &lt;div id="chartBlock" style="width: 900px; height: 500px;"&gt;&gt;
  
  &lt;script type="text/javascript"&gt;
      // Load the Visualization API and the piechart package.
      google.load('visualization', '1.0', {'packages':['corechart']});
  
      // Set a callback to run when the Google Visualization API is loaded.
      google.setOnLoadCallback(initCharts);
  
      function initCharts() {         
        // Following the usual Remoting syntax
        // [&lt;namespace&gt;.]&lt;controller&gt;.&lt;method&gt;([params...,] &lt;callbackFunction&gt;(result, event) {...}
        // controller : GoogleChartsController
        // method : loadOpps
        GoogleChartsController2.loadOpps( 
               function(result, event){
  
                   // load Column chart
                   var visualization = new    google.visualization.BubbleChart(document.getElementById('chartBlock'));
                   // Prepare table model for chart with columns
                   var data = new google.visualization.DataTable();
                   data.addColumn('string', 'Opportunity');             
                   data.addColumn('number', 'Days To Contract Start');
                   data.addColumn('number', 'Probability (%)');
                   data.addColumn('string', 'Lead Source');  
                   data.addColumn('number', 'Amount');  
                   // add rows from the remoting results
                   for(var i =0; i&lt;result.length;i++){
                      var r = result[i];
                      data.addRow([r.Name, r.DaysToStartDate__c, r.Probability, r.LeadSource, r.Amount]); 
                    }
                  // all done, lets draw the chart with some options to make it look nice.
                  visualization.draw(data, {
                      legend : {position: 'right', textStyle: {color: 'black', fontSize: 10}},                         
                      width:window.innerWidth,
                      length:window.innerLength,
                      vAxis:{title: 'Probability', textStyle:{fontSize: 10}, minValue: 0, maxValue: 100},
                      hAxis:{title: 'Days Until Close' , textStyle:{fontSize: 10}, 
                      chartArea: {width: '50%', height: '75%'},  
                      sizeAxis: {minSize: 150, minValue: 150},
                      showTextEvery:1,slantedText:false}})
                    }, 
                    {escape:true});
  
        } 
  &lt;/script&gt;
  
  &lt;/div&gt;&lt;/apex:sectionheader&gt;&lt;/apex:includescript&gt;
  
   &lt;apex:form &gt;
        &lt;apex:outputlabel value="Enter your name here"/&gt;
        &lt;apex:inputField value="{!proxyObject.closeDate}"/&gt;
        &lt;apex:actionsupport event="onclick" rerender="display" /&gt;   
  
        &lt;apex:outputpanel id="display"&gt;
         &lt;apex:outputtext value="The date entered is {!proxyObject.closeDate}"/&gt;
        &lt;/apex:outputpanel&gt;            
  &lt;/apex:form&gt;
  
  
  &lt;/apex:page&gt;
  </code></pre>