• John Neff
  • NEWBIE
  • 335 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 69
    Questions
  • 91
    Replies
Good Evening, 

I am using AggregateResult and GROUP BY ROLLUP to output some data.  After a long slog, I've got it working the way I need it to... except for one thing.  The "Total" row is showing at the top of the list instead of the bottom when I put the data into a table. 

Would anybody be able to help me get my total row so that it is the last item in the table?

Here is my VF page: 
<apex:page controller="CurrentWeekDY">
 
 <apex:pageBlock title="Delivery WTD">
 <apex:pageBlockTable value="{!DelSumOut}" var="dy">
   <apex:column value="{!dy.Campaign}" headerValue="Campaign" />
   <apex:column value="{!dy.Delivery}" headerValue="Delivery" />  
 
 </apex:pageBlockTable>
 </apex:pageBlock>
 
 

And here is my controller: 
public class CurrentWeekDY {
    public class DelSum {
        public String Campaign {get; set;}
        public String Delivery {get; set;}

        public DelSum(string c, string d) {
            this.Campaign = c;
            this.Delivery = d;
        }
    }

    public List<DelSum> DelSumList = new List<DelSum>();

    public List<DelSum> getDelSumOut() {
        AggregateResult[] AgR = [SELECT Camp__c, SUM(Spend__c) FROM TL_Client__c WHERE CWDelivery__c = TRUE GROUP BY ROLLUP(Camp__c) ORDER BY Camp__c];

        for (AggregateResult DYList : AgR) {
            DelSumList.add(new DelSum(String.valueOf(DYList.get('Camp__c')), String.valueOf(DYList.get('expr0'))));
        }

        return DelSumList;
    }
}


I would really appreciate any help!!

Thanks, 
 

John 

Hello,

I am trying to use AggregateResult to build a controller for a VF page.  This is the fist time that I am using this function and am recieving the error: 
Error: Compile Error: Missing '<EOF>' at 'public' at line 10 column 1

I have googled this like crazy, and seem to understand that it is because I have markup outside of the wrapper but I still can't understand how to fix it?  Can anyone help?

Here is my class: 
 
public class CurrentWeekDY{
    String Campaign {get; set;}
    String Delivery {get; set;}
        public DelSum(string c, string d){
        this.Campaign=c;
        this.Delivery=d;
        
    }
}
public List<DelSum> DelSumList = new List<DelSum>();

public List<DelSum> getDelSumOut(){

    AggregateResult[] AgR = [SELECT Campaign_TL__c, SUM(Spend__c) FROM TL_Client__c WHERE CWDelivery__c = TRUE GROUP BY Campaign_TL__c ORDER BY Campaign_TL__c]; 
    for (AggregateResult DYList : AgR) { 
        DelSumList.add(new DelSum(String.valueOf(DYList.get('Campaign_TL__c')), String.valueOf(DYList.get('expr0')), String.valueOf(DYList.get('expr1'))));
    }
    return DelSumList;
}

Thank you so much for any help!

John 

Hello, 
 

I am trying to build a "Copy To Clipboard" button for one of my VF pages. 

I found the code below on GitHub (will attribute author at bottom), but it displays the text to be copied in an output field.  The functionality works just as I want it to, but I don't want to display the text, I just want to store it behind the button.  Can anyone help me convert the OutPutPanel portion to a stored variable?  I've been playing around with this for a while and can't figure it out. 

Here is the code: 
 

<apex:page title="Clipboard Test" >
<apex:messages />
    <script language="JavaScript">
        function ClipBoard(copytextid, holdtextid){
            copyToClipboard(copytextid);
        }
        function copyToClipboard(elementId) {
          // Create an auxiliary hidden input
          var aux = document.createElement("input");
          // Get the text from the element passed into the input
          aux.setAttribute("value", document.getElementById(elementId).innerHTML);
          // Append the aux input to the body
          document.body.appendChild(aux);
          // Highlight the content
          aux.select();
          // Execute the copy command
          document.execCommand("copy");
          // Remove the input from the body
          document.body.removeChild(aux);
        }    
    </script>   
    <apex:pageblock >
    <apex:form >
        <apex:outputpanel ID="copytext" STYLE="height:150;width:162;background-color:pink">
            TEXT TO BE COPIED
        </apex:outputpanel> 
        <apex:inputtextarea ID="holdtext" STYLE="display:none;"></apex:inputtextarea>
        <apex:commandbutton onClick="ClipBoard('{!$Component.copytext}', '{!$Component.holdtext}');" rerender="copytext" value="Copy to Clipboard"/> 
    </apex:form>
    </apex:pageblock>
</apex:page>
**Source: https://gist.github.com/nithesh1992/dc66708bde9ab94313a731a715fef9ad#file-copy-txt

I want to accomplish something like this:
 
<apex:variable ID="copytext" value="TEXT TO BE COPIED" "/>
            
      
        <apex:inputtextarea ID="holdtext" STYLE="display:none;"></apex:inputtextarea>
        <apex:commandbutton onClick="ClipBoard('{!$Component.copytext}', '{!$Component.holdtext}');" rerender="copytext" value="Copy to Clipboard"/>

So that the only visable piece is the button.  Can anyone help me with this?!

Thank you, and happy thanksgiving!
Hello, 

I am trying to write a test class for a VF controller, and I am getting an error saying the variable does not exist even though it does!  Why would this be happening? 

Here is my controller: 
 
public class DailySalesReportController{ 

        public List<Opportunity> listOfCefOpToday {get;set;}
        public List<Opportunity> listOfLoganOpToday {get;set;}
        public List<Lead> listOfCefLdToday {get;set;}
        public List<Lead> listOfLoganLdToday {get;set;}
        public List<Sales_Meetings__c> listOfCefSkedToday {get;set;}
        public List<Sales_Meetings__c> listOfLoganSkedToday {get;set;}
        public List<Sales_Meetings__c> listOfCefOcToday {get;set;}
        public List<Sales_Meetings__c> listOfLoganOcToday {get;set;}
        public Opportunity CefOpToday {get;set;}
        public Opportunity LoganOpToday {get;set;}
        public Lead CefLdToday {get;set;}
        public Lead LoganLdToday {get;set;}
        public Sales_Meetings__c CefSkedToday {get;set;}
        public Sales_Meetings__c LoganSkedToday {get;set;}
        public Sales_Meetings__c CefOcToday {get;set;}
        public Sales_Meetings__c LoganOcToday {get;set;}
    
    public DailySalesReportController(){
        listOfCefOpToday = [Select id, name from Opportunity WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Jeff Cefalu'];
        listOfLoganOpToday = [Select id, name from Opportunity WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Logan Connolly'];
        listOfCefLdToday = [Select id, name from Lead WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Jeff Cefalu'];
        listOfLoganLdToday = [Select id, name from Lead WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Logan Connolly'];
        listOfCefSkedToday = [Select id, name from Sales_Meetings__c WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Jeff Cefalu'];
        listOfLoganSkedToday = [Select id, name from Sales_Meetings__c WHERE Created_Today__c = TRUE AND Owner_Name__c = 'Logan Connolly'];
        listOfCefOcToday = [Select id, name from Sales_Meetings__c WHERE Occurred_Today__c = TRUE AND Owner_Name__c = 'Jeff Cefalu'];
        listOfLoganOcToday = [Select id, name from Sales_Meetings__c WHERE Occurred_Today__c = TRUE AND Owner_Name__c = 'Logan Connolly'];
        
        
}
}

And here is my test: 
 
@isTest(seeAllData = true)
public class DailySalesReportControllerTest{
    // Unit test Method
    static testmethod void UnitTest() {
        //Create your Opportunity record with required field
        //Opportunity b = new Opportunity(Created_Today__c = TRUE);
        //insert b;
        test.startTest();
           DailySalesReportControllerTest ub = new DailySalesReportControllerTest();
           
           if(ub.listOfCefOpToday!=null && !ub.listOfCefOpToday.isEmpty())
           Opportunity cefOpportunity = ub.listOfCefOpToday.get(0);
           
           if(ub.CefOpToday !=null)
            String CefOpTodayId = ub.CefOpToday.Id;
           
        test.stopTest();
    }   
}

I keep getting this error: 
 
Error: Compile Error: Variable does not exist: listofcefoptoday at line 12 column 41

Can anyone help?  I'm really stuck here 
Hello, 

I have an apex class that functions as a VF page controller, and when I run the associated test class it passes - but when I look at the class the coverage is at 0% and it is bringing my code coverage down below 75%.  How can this be?  I would really appreciate some help here!

Here is my controller: 
 
public class R2MBizBookController{

    public List<Buyer__c> listOfDeck {get; set;}
    public List<Buyer__c> listOfNewThirty {get; set;}
    public List<Buyer__c> listOfNewTW {get; set;}
    public List<Buyer__c> listOfLegacy {get; set;}
    public List<Buyer__c> listOfTQ {get; set;}
    public List<Buyer__c> listOfAQ {get; set;}
    public List<Buyer__c> listOfBQ {get; set;}
    public List<Buyer__c> listOfCQ {get; set;}
    public List<Buyer__c> listOfDQ {get; set;}
    public List<Buyer__c> listOfEQ {get; set;}
    public Buyer__c Live {get; set;}
    public Buyer__c NewTW {get; set;}
    public Buyer__c Viability {get; set;}
    public Buyer__c LaunchPad {get; set;}
    public Buyer__c TQ {get; set;}
    public Buyer__c AQ {get; set;}
    public Buyer__c BQ {get; set;}
    public Buyer__c CQ {get; set;}
    public Buyer__c DQ {get; set;}
    public Buyer__c EQ {get; set;}
   
public R2MBizBookController() {
    listofDeck = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Commitment_c__c from Buyer__c WHERE Pipeline_Status__c = 'OnDeck' ORDER BY Name ASC];
    listofNewThirty = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'New 30' ORDER BY Sales_Origination_Date__c DESC];
    listofNewTW = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE  New_Live__c = TRUE  ORDER BY Sales_Origination_Date__c DESC];
    listofLegacy = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'Legacy' ORDER BY  Sales_Origination_Date__c DESC];
    listofTQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE TQ_Pipeline__c = TRUE ORDER BY  Sales_Origination_Date__c DESC];
    listofAQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'AQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofBQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'BQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofCQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'CQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofDQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'DQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofEQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'EQ' ORDER BY  Sales_Origination_Date__c DESC];
   


}
}

and here is my test class: 
 
@isTest(seeAllData =  true)
public class R2MBizBookControllerTest{
    // Unit test Method
    static testmethod void UnitTest() {
        //Create your buyer record with required field
        //Buyer__c b = new Buyer__c(Pipeline_Status__c = 'Legacy');
        //insert b;
        test.startTest();
           R2MBizBookController ub = new R2MBizBookController();
        test.stopTest();
    }   
}

I ill be eternally grateful if someone can help me solve this!

Thank you, 

John
Hello, 

I have a controller that is showing 0% code coverage, but I'm not sure why my test class isn't covering anything.  Can anyone help? 

Here is my controller: 
 
public class R2MBizBookController{

    public List<Buyer__c> listOfDeck {get; set;}
    public List<Buyer__c> listOfNewThirty {get; set;}
    public List<Buyer__c> listOfNewTW {get; set;}
    public List<Buyer__c> listOfLegacy {get; set;}
    public List<Buyer__c> listOfTQ {get; set;}
    public List<Buyer__c> listOfAQ {get; set;}
    public List<Buyer__c> listOfBQ {get; set;}
    public List<Buyer__c> listOfCQ {get; set;}
    public List<Buyer__c> listOfDQ {get; set;}
    public List<Buyer__c> listOfEQ {get; set;}
    public Buyer__c Live {get; set;}
    public Buyer__c NewTW {get; set;}
    public Buyer__c Viability {get; set;}
    public Buyer__c LaunchPad {get; set;}
    public Buyer__c TQ {get; set;}
    public Buyer__c AQ {get; set;}
    public Buyer__c BQ {get; set;}
    public Buyer__c CQ {get; set;}
    public Buyer__c DQ {get; set;}
    public Buyer__c EQ {get; set;}
   
public R2MBizBookController() {
    listofDeck = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Commitment_c__c from Buyer__c WHERE Pipeline_Status__c = 'OnDeck' ORDER BY Name ASC];
    listofNewThirty = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'New 30' ORDER BY Sales_Origination_Date__c DESC];
    listofNewTW = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE  New_Live__c = TRUE  ORDER BY Sales_Origination_Date__c DESC];
    listofLegacy = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'Legacy' ORDER BY  Sales_Origination_Date__c DESC];
    listofTQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE TQ_Pipeline__c = TRUE ORDER BY  Sales_Origination_Date__c DESC];
    listofAQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'AQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofBQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'BQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofCQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'CQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofDQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'DQ' ORDER BY  Sales_Origination_Date__c DESC];
    listofEQ = [Select id, name, Sales_Lead_Source__c, Routing_Status__c, Client_Status__c, Total_Re_Orders__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'EQ' ORDER BY  Sales_Origination_Date__c DESC];
   
and here is my test: 

}
}
and here is my test? 
 
@isTest(seeAllData = false)
public class R2MBizBookControllerTest{
    // Unit test Method
    static testmethod void UnitTest() {
        //Create your buyer record with required field
        //Buyer__c b = new Buyer__c(Pipeline_Status__c = 'Legacy');
        //insert b;
        test.startTest();
           R2MBizBookController ub = new R2MBizBookController();
        test.stopTest();
    }   
}

would anyone be willing to help me beef this up?

it would mean the world to me. 

thank you in advance!!!!!!

John 
 

Hello, 

I am attempting to use inputText on a VF page and can't figure out how to save the value to the record.  Does anyone have an example of this that I could bootstrap off of? 

I am using a custom object & controller. 
 

Here is the string from the VF page: 
 

apex:inputText value="{!spotObj.Workload__c}"/> <apex:commandButton value="Save" action="{!saveSpot}"/>
And here is my controller: 
 
public with sharing class SpotsInProcess{

    public List <Job_Number__c> listOfInProgress {get;set;}
    public Job_Number__c InProgress  {get;set;}

public PageReference saveSpot(){
    UPDATE listOfInProgress;
    return null;
    }


public SpotsInProcess(){
    listOfInProgress = [Select id, name, Workload__c, Notes__c, Thumbnail_URL__c, ISCI__c, Title__c,   First_Air_Date__c,  Last_Air_Date__c, Project__c, Campaign__r.Name, Nets_Running__c, View_Link__c, Internal_Title__c, Legal__c, Airing_Agencies__c from Job_Number__c where Job_Status__c = 'In Progress']; 
}
}

It would mean the world to me if someone could help me out!

Thanks in advance! 
 
Hello, 

I am using apex:outputLink on a vf page to open a new window - but it is refreshing my original page upon click.  Is there a way to stop this?  Here is my link. 
 
<apex:outputLink onclick="window.open('AllSpotsMoreDetails?id={!spotObj.Id}', 'newwindow', 'width=800, height=900')"> More Details</apex:outputLink>

Thanks, 

John

 
Hello, 

I have a VF page that is using apex:repeat to create a table column for each related object record like so:
 
<apex:repeat value="{!Quarterly_Buy__c.Media_Buys__r}" var="buys">
                     <td style="background-color: #D8D8D8; color: #190707;font-size:14px;" align="center">
                        <b>{!MONTH(buys.Broadcast_Week__c)}/{!DAY(buys.Broadcast_Week__c)}/{!VALUE(RIGHT(TEXT(YEAR(buys.Broadcast_Week__c)),2))}</b>
                    </td>

I want to add a condition where a column is only renedered if the field "Broadcast_Week__c" on the child record is greater than Today. 

I have adding a "Display" attribute to the td saying: 
 
display: {!IF(Quarterly_Buy__c.Media_Buys__r.Broadcast_Week__c < Today(), 'none', 'table-column')};"

but I am getting en error. 

Can anyone help? 

Thanks, 

John
Hello, 

I am trying to add UPDATE functionality to a controller and am getting the error: DML requires SObject or SObject list type: List<String>

However my variable is set up like this: public List<String> campaigns {get;set;}

I am not sure how to achieve the proper syntax here, and was hoping that someone out there in developerland would be able to help me!

Here is my (broken) controller: 
 
public with sharing class QualOpController
{

public List <Opportunity> listOfOpty {get;set;}
public List<String> campaigns {get;set;}

public PageReference saveOp(){
    UPDATE campaigns;
    return null;
    }

 public String getName(){
        return 'QualOpController';
        }

public void load() 
{
  campaigns= new List<String>();
  listOfOpty = [Select id, name, CreatedDate, StageName, Vert_Med__c, Company_Name__c, Next_Step__c, Vertical__c, Weeks_Live__c, Days_Since_Last_Modified__c, Contract_SENT__c, NextStep, LeadSource, Probability, Spend_Last_Week__c, Spend_Last_30_Days__c, Owner_Name__c, Revenue_All_Time__c from Opportunity WHERE Pipeline_Oppty__c = TRUE ]; 
  
  Set<String> campaignSet = new Set<String>();
  for (Opportunity j : listOfOpty)
      campaignSet.add(j.Vert_Med__c);
      
      for (String campaign : campaignSet) 
      {
            campaigns.add(campaign);
      }
      campaigns.sort();
    }
}

Thanks in advance!

John