• Amit Singh Mumbai
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 1

Hi friends,

i have Follwing objects



Estimate line item (Estimate)

GLCode etc.

i am focusing on Estimate object and GLCode object because my question is related to these two objects only.


On GLCode and Estimate, a picklist field is there,

Department (values are same for both the object, values are- Computer services,Photography and production)


GL Code is master of Estimate Object (lookup relationship).


first we need to create GL Code in which Department field is required.


Now when we create any Estimate then first we select department then we select GLCode (Only those GLCode will be populated for which Department is same as Department selected on Estimate... because on GLCodes lookup we are using filter criteria).


i have created a vf page where i am displaying list of Etimates... here i am using inline edit support...

Inline edit support is set for Department as well as GlCode.

i am getting problem while using inline editing , when i changed Department ,then clicked on GlCode ( i am not getting glcode based on new selected department in my lookup window... it shows based on previous on)...

How to solve this kind ob issue?


here is my Code.


thanks in Advance

<apex:page Controller="DisplayEstimateunderJobTab">
function buttonClicked(myButton) {
    return false;

 <apex:form >
  <apex:pageMessages />
   <apex:pageBlock tabStyle="Vendor_Quote__c" mode="edit">
     <h1>Estimate Line Items </h1>
     <apex:commandButton action="{!CreateVQ}" value="New Line Item" id="btn1"/> 
   <center>  <apex:commandButton value="Save" action="{!save}" id="saveButton" style="display: none;"/>  
     <apex:commandButton value="Cancel" id="cancelButton" onclick="resetInlineEdit()" style="display: none;"/>   </center>
      <apex:pageBlockTable value="{!vq}" var="vquote" rendered="{!vq.Size > 0}"> <br/><br/><br/> 
         <apex:column headerValue="Action">
             <apex:commandButton value="Approve" action="/apex/ApproveEstimate?id={!vquote.id}" id="myButton" oncomplete="return buttonClicked(this);"/>  
         <apex:column headerValue="Approved">
          <apex:outputField value="{!vquote.Approved__c}"/>
          <apex:column headerValue="Name">
         <apex:outputLink tabindex="tab1" value="/apex/Estimatedetailpage?id={!vquote.Id}">{!vquote.Name}</apex:outputLink>
          <apex:column headerValue="Vendor">
          <apex:outputfield value="{!vquote.Vendor__r.Name}"/>
           <apex:column headerValue="PO Created">
          <apex:outputField value="{!vquote.PO_Created__c}"/>
          <apex:column headerValue="Department">
       <apex:outputField value="{!vquote.GL_Department__c}" >
        <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="btn1" rendered="{!vquote.PO_Created__c = false}" resetFunction="resetInlineEdit"/> </apex:outputfield> 
<apex:column headerValue="GL Code"> <apex:outputField value="{!vquote.GL_Code__c}"> <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="btn1" rendered="{!vquote.PO_Created__c = false}" resetFunction="resetInlineEdit"/> </apex:outputfield> </apex:column> <apex:column headerValue="Unit Type"> <apex:outputfield value="{!vquote.Unit_Type__c}"/> </apex:column> <apex:column headerValue="Quantity"> <apex:outputfield value="{!vquote.Quantity__c}"> <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="btn1" rendered="{!vquote.PO_Created__c = false}" resetFunction="resetInlineEdit"/> </apex:outputfield> </apex:column> <apex:column headerValue="Unit Cost"> <apex:outputfield value="{!vquote.Amount__c}"/> </apex:column> <apex:column headerValue="Total Cost"> <apex:outputfield value="{!vquote.Total_Amount__c}"/> </apex:column> </apex:pageBlockTable> <br/> <div style="float:right;padding-right:65px;font-size:1.10em;font-style:normal;font-family: 'Calibri';font-weight:bold"> <apex:outputPanel rendered="{!vq.Size > 0}"> <apex:outputLabel value="Total Cost ($)" style="font-style:italic;" /> <apex:outputText value="{0,Number, ###,###,###.00}"> <apex:param value="{!sumCash}"/> </apex:outputText> </apex:outputPanel> </div> </div> <br/> <apex:pageBlockSection rendered="{!vq.size <= 0}"> <apex:pageBlockSectionItem > No records to display. </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

public class DisplayEstimateunderJobTab

public List<Estimate_Line_Items__c> vq{get;set;}
public List<Estimate_Line_Items__c> vq1{get;set;} 
String theID;
    public DisplayEstimateunderJobTab() 
 theID = ApexPages.CurrentPage().getParameters().get('id');
 vq=[select id,Name,Approved__c,PO_Created__c,GL_Code__r.Name,GL_Department__c,Job__c,Vendor__r.Name,Quote__r.Name,Amount__c,Total_Amount__c,Quantity__c,Unit_Type__c from Estimate_Line_Items__c where Job__c =: [Select id from Job__c where id =: theID] Order By Name];
    public double getSumCash()  
            SObject sumCash;  
            sumCash = [SELECT SUM(Total_Amount__c) sum FROM Estimate_Line_Items__c WHERE Job__c =: [Select id from Job__c where id =: theID] and Approved__c = true];
            return double.valueOf(sumCash.get('sum'));
     public PageReference save()
      update vq;
     catch(System.DMLException e)
                 return null;
     return null;

     public PageReference CreateVQ()
       String jobid;
       String theId=ApexPages.CurrentPage().getParameters().get('id');
       Estimate_Line_Items__c est = new Estimate_Line_Items__c();
       Job__c job = [Select Id from Job__c where id =: theID];
      PageReference p = Page.CreateNewEstimate;
     return p;
     //return null;



I'm using AggregateResult in order to return sum of shipments for every combination of customeregion,productfamily and year,here is the query i'm using
apex code:
public AggregateResult[] queryResult { get {return queryResult ;} set{ queryResult = value ;} }
public AggregateResult[] getschemalist22()
 queryResult = [select sum(shp_4000__c) salesshipments,sum(shp_4010__c) inventoryshipments,sum(sos_5000__c) salesoutshipments,Time__r.Years__c years,
   Customer__r.Region__c regions, JaguarProduct__r.Family__c families from FACT_LL__c
   group by Time__r.Years__c, Customer__r.Region__c, JaguarProduct__r.Family__c];
 return queryResult;

Now i required to display this aggregateresult in my visualforce page pageblocktable like

Customerregion       Productfamily        Year          Measures                                values

ASIA                             prodfamily1             2010         salesshipments                      2000
                                                                                          inventoryshipments                340
                                                                                          salesoutshipments                1090


NORTH AMERICA     prodfamily1            2010         salesshipments                      6100
                                                                                          inventoryshipments                900
                                                                                          salesoutshipments                5600


which displays 2 records with "sum of shipments for region asia,productfamily1,year 2010" and"sum of shipments for region northamerica,productfamily1,year 2010".


please specify if this is the right way to get aggregateresult,if yes please let me know how to display it in visualforce page

as desired or is there any other way to display the result.

Any help is much appreciated.


Thanks & Regards,