• akst
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi - I am new to APEX, I have a query that looks like this. What am I doing wrong and how do I write a test case.

 

Thanks

 

 

public class GroupedQuery
{
    public string GroupBy1     {get;set;}
    public string GroupBy2     {get;set;}
    public string GroupBy3     {get;set;}
    public integer Count {get;set;}
    public Decimal Sum {get;set;}
    public Decimal Average {get;set;}
    public Decimal Min {get;set;}
    public Decimal Max {get;set;}

public List<GroupedQuery> queryResults {get;set;}

public List<sObject> queries = [Select b.Period__r.Name Name, SUM(b.Amount__c) Amount From Bud__c b group by Period__r.Name];
 {                                          
queryResults = new List<GroupedQuery>();
for (sObject query: queries)
{
    GroupedQuery myObject = new GroupedQuery();
    myObject.Count = Integer.valueOf(query.get('Amount'));
    myObject.GroupBy1 = String.valueOf(query.get('Name'));
    queryResults.Add(myObject);
}   }   }    

 

 

  • November 18, 2010
  • Like
  • 0

Hi - I am new to APEX, I have a query that looks like this. What am I doing wrong and how do I write a test case.

 

Thanks

 

 

public class GroupedQuery
{
    public string GroupBy1     {get;set;}
    public string GroupBy2     {get;set;}
    public string GroupBy3     {get;set;}
    public integer Count {get;set;}
    public Decimal Sum {get;set;}
    public Decimal Average {get;set;}
    public Decimal Min {get;set;}
    public Decimal Max {get;set;}

public List<GroupedQuery> queryResults {get;set;}

public List<sObject> queries = [Select b.Period__r.Name Name, SUM(b.Amount__c) Amount From Bud__c b group by Period__r.Name];
 {                                          
queryResults = new List<GroupedQuery>();
for (sObject query: queries)
{
    GroupedQuery myObject = new GroupedQuery();
    myObject.Count = Integer.valueOf(query.get('Amount'));
    myObject.GroupBy1 = String.valueOf(query.get('Name'));
    queryResults.Add(myObject);
}   }   }    

 

 

  • November 18, 2010
  • Like
  • 0