• Linda Malby
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,

I'm new to Apex and Visualforce and hoping you guys can help me out with something to save me scratching my head any more than I have been!

I'm trying to create a simple proof of concept Visualforce dashboard with an Apex chart with a filter which determines what data is shown in the chart.  The idea being that the filter would show a list of users and upon selecting a user, I see that user's data in the chart.  

I have the filter working fine and passing the selected value back to the Apex class into a variable called 'reps;.  However, I am then struggling to use that 'reps' value in the SOQL query which is used to populate the chart.
 
public List<Opportunity> getAccountList () {
//reps = '005J0000001ftxkIAA';
System.Debug(reps);
   List<Opportunity> con = [SELECT Name, Type,createddate, Amount, Closedate FROM Opportunity WHERE OwnerID =: reps];
   System.Debug('Got to here aswell' ) ;
            System.Debug(reps);

   return con;
}

From the debug lines, I can tell that the 'reps' variable is holding the correct value, populated from the select list dropdown, before and after the SOQL query is executed but I can see my SOQL query is returning zero records.  However, if i uncomment the line to force the exact same value into the 'reps' variable, the query executes fine and returns three rows.

Can anyone give me some pointers as to where I could be going wrong?

Many thanks in advance,
Linda