• aks001
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 18
    Replies

Hi,

 

I'm trying to calculate the week of month using apex . what I actually want is suppose if I have 52 records created with the start date and end dates like.. 1st... 1/1/2014 to 8/1/2014. 2nd ... 8/1/2014 to 15/1/2014 and so on....

so I want to calculate that what is the number of week like.... 1st week , 2nd week and so on....

 

if anyone has the solution for this than please let me know .............. thanks in advance..... :)

  • December 11, 2013
  • Like
  • 0

Hi,

 

I want to calculate the week of day from the end date ,  that it's in ..... like my date is 1/1/2014 to 8/1/2014 and 8/1/2014 to 15/1/2014 ... and the result would be like... 1 , 2, 3 and so on....

 

if anyone has the solution then plz let me know.... thanks in advance...... :)

  • December 11, 2013
  • Like
  • 0

Hi,

 

I'm facing this problem while creating an asset record. so if anyone knows that how to fix this than plz let me know. thanks.. in advance.................. :)

  • December 06, 2013
  • Like
  • 0

Hi,

 

I'm trying to calculate the week of month nd m failing with this approach.

 

MOD(FLOOR((StartDate__c - DATE(YEAR(StartDate__c),1,1)/7) + 26,52)+1)

 

what I actually want is suppose if I have 52 records created with the start date and end dates like.. 1st... 1/1/2014 to 8/1/2014. 2nd ... 8/1/2014 to 15/1/2014 and so on....

so I want to calculate that what is the number of week like.... 1st week , 2nd week and so on....

 

if anyone has the solution for this than please let me know .............. thanks in advance..... :)

  • December 05, 2013
  • Like
  • 0

Hi,

 

I'm trying to remove duplicate eleements from a list using iterator and it's not allowing me to do so, saying that you can't modify the  list while iterating the same.

 

Iterator<InvoiceLineItem__c> itr = invoiceLineItems.iterator();
        
        while(itr.hasNext()){
           for (integer i = 0; i < invoiceLineItems.size(); i++){
                if (itr.next() == invoiceLineItems.get(i)){
                    invoiceLineItems.remove(i);
                }
            }
        }

 

 

If you guys knowing any of it's solutions than plz let me know. thanks in advance ................ :)

  • December 04, 2013
  • Like
  • 0

Hi,

 

I'm having a problem with my list of elements and now i want to create an iterator for this list. so can anyone plz tell me that how to create or use iterator in salesforce using apex.

 

thanks in advance ... :)

  • December 03, 2013
  • Like
  • 0

Hi,

 

I'm having problem with this approach for creating invoiceLineItems, ultimately this is giving me an error saying that System.ListException: Before Insert or Upsert list must not have two identically equal elements..

now bellow is the code. if any one has any of the solutions that plz let me know.

          

 

       for(opportunityLineItem olis : opportunityLineItems)

                            Date WeekStartDate = olis.StartDate__c.date();
                            Date WeekEndDate = olis.EndDate__c.date();
                            Interval = startDate.daysBetween(endDate) / 7;
                          
                            if(interval == 0){
                               interval = 1;
                            }
                           
                           
                            for(integer i = 0; i < interval; i++){
                                InvoiceLineItem__c invoiceLineItem = new InvoiceLineItem__c();
                                if(interval > 1){
                                    invoiceLineItem.StartDate__c = WeekStartDate.addDays(sdays1);
                                    invoiceLineItem.EndDate__c = WeekStartDate.addDays(edays2);
                                    sdays1 = sdays1 + 7;
                                    edays2 = edays2 + 7;
                                }
                                else{
                                    invoiceLineItem.StartDate__c = WeekStartDate;
                                    invoiceLineItem.EndDate__c = WeekEndDate;
                                  
                                }
                                oliIli.add(new opportunityLineItemInvoiceLineItemWrapper(invoiceLineItem, olis));
                              
                            }

 

              }

 

 

 

Thanks in Advance...  :)

  • November 26, 2013
  • Like
  • 0

hi,

 

I want to get the number of weeks comes in startDate and endDate and i'm not getting the way.... so plz if anyone knows how to do it then let me know... thanks... in advance... :)

  • November 08, 2013
  • Like
  • 0

hi,

 

I want to split dates according to monthsBetween() start date and end date  and I'm confused so if any one has any of the solutions... than plz ... tell me... thanks in advance....  :)

 

  • November 06, 2013
  • Like
  • 0

hi,

 

I want to update a child object field when if opportunity line item 's quantity gets updated and that object which gonna be informed that the opportunity is got updated .... is the child to opportunity . so for that I'm writting a trigger and getting confused in fetching the old value of that field..... to match .in the if condition....

 

public void statusUpdate(List<opportunity> newOpps, List<opportunity> oldOpps){
        List<String> oppIds = new List<String>();
        List<opportunityLineItem> opportunityLineItemsNew = new List<opportunityLineItem>();
        List<production__c> productionTickets = new List<production__c>();
        for(opportunity oppNw : newOpps){
            oppids.add(oppNw.id);
        }
        
        opportunityLineItemsNew = [Select id, opportunityId, quantity, StartDate__c, EndDate__c, CostType__c From opportunityLineItem where opportunityID in : oppids];
        productionTickets = [select id, name, Opportunity__c, OpportunityStatus__c from production__c where Opportunity__c in : oppids];
        
        for(Production__c pt : productionTickets){
            for(opportunityLineItem oli : opportunityLIneItemsNew){
                if(oli.opportunityId == pt.opportunity__c){
                    if(oli.quantity != ?????? ){
                   
                    }
                }
            }
        }
    }

 

so plz tell me if you have any of the solutions.... thanks in advance........................... :)

  • October 15, 2013
  • Like
  • 0

HI there,

it's really confusing that how it is picking values by using {!filterId}
expression selectList component???

<apex:page standardController="Case" recordSetvar="cases">
    <apex:pageBlock >
        <apex:form id="theForm">
            <apex:panelGrid columns="2">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                </apex:selectList>
            </apex:panelGrid>
            <apex:pageBlockSection >
                <apex:dataList var="c" value="{!cases}" id="list">
                    {!c.subject}
                </apex:dataList>
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>
</apex:page>

if anyone knows it there than please update me..... thanks.. in advance :)

  • October 04, 2013
  • Like
  • 0

hi there,

friends I have a vf page that generating pdf and that page has a controller that is getting data from a master object and also from it's multiple child records using fieldsets the both objects having it's own fieldset and now when I'm doing

ApexPages.StandardController controller;
        productionEditControl proController = new productionEditControl(controller);
       
        //inserting test data... contains one production ticket and production line item under it...
        production__c p = new production__c();
        p.name = 'new test prodution 0011112';
        insert p;
       
        List<ProductionLineItem__c> plis = new List<ProductionLineItem__c>();
        for(Integer i = 0; i<=3; i++){
            productionLineItem__c pli = new productionLineItem__c();
            pli.production__c = p.id;
            plis.add(pli);
        }
        insert plis;
       
        // now passing the id to related page to use that data inserted above...
        PageReference pageRef = Page.EditProductionTicket;
        pageRef.getParameters().put('id', p.id);
        Test.setCurrentPage(pageRef);
       
        // calling instance methods...
        proController.save();
        proController.cancel();


it's giving me an error saying .... List has no rows for assignment to SObject so please tell me how to solve it..

 

thanks in advance.....

  • October 02, 2013
  • Like
  • 0

Hi,

 

I'm facing this problem while creating an asset record. so if anyone knows that how to fix this than plz let me know. thanks.. in advance.................. :)

  • December 06, 2013
  • Like
  • 0

Hi,

 

I'm trying to calculate the week of month nd m failing with this approach.

 

MOD(FLOOR((StartDate__c - DATE(YEAR(StartDate__c),1,1)/7) + 26,52)+1)

 

what I actually want is suppose if I have 52 records created with the start date and end dates like.. 1st... 1/1/2014 to 8/1/2014. 2nd ... 8/1/2014 to 15/1/2014 and so on....

so I want to calculate that what is the number of week like.... 1st week , 2nd week and so on....

 

if anyone has the solution for this than please let me know .............. thanks in advance..... :)

  • December 05, 2013
  • Like
  • 0

Hi,

 

I'm trying to remove duplicate eleements from a list using iterator and it's not allowing me to do so, saying that you can't modify the  list while iterating the same.

 

Iterator<InvoiceLineItem__c> itr = invoiceLineItems.iterator();
        
        while(itr.hasNext()){
           for (integer i = 0; i < invoiceLineItems.size(); i++){
                if (itr.next() == invoiceLineItems.get(i)){
                    invoiceLineItems.remove(i);
                }
            }
        }

 

 

If you guys knowing any of it's solutions than plz let me know. thanks in advance ................ :)

  • December 04, 2013
  • Like
  • 0

Hi,

 

I'm having a problem with my list of elements and now i want to create an iterator for this list. so can anyone plz tell me that how to create or use iterator in salesforce using apex.

 

thanks in advance ... :)

  • December 03, 2013
  • Like
  • 0

Hi,

 

I'm having problem with this approach for creating invoiceLineItems, ultimately this is giving me an error saying that System.ListException: Before Insert or Upsert list must not have two identically equal elements..

now bellow is the code. if any one has any of the solutions that plz let me know.

          

 

       for(opportunityLineItem olis : opportunityLineItems)

                            Date WeekStartDate = olis.StartDate__c.date();
                            Date WeekEndDate = olis.EndDate__c.date();
                            Interval = startDate.daysBetween(endDate) / 7;
                          
                            if(interval == 0){
                               interval = 1;
                            }
                           
                           
                            for(integer i = 0; i < interval; i++){
                                InvoiceLineItem__c invoiceLineItem = new InvoiceLineItem__c();
                                if(interval > 1){
                                    invoiceLineItem.StartDate__c = WeekStartDate.addDays(sdays1);
                                    invoiceLineItem.EndDate__c = WeekStartDate.addDays(edays2);
                                    sdays1 = sdays1 + 7;
                                    edays2 = edays2 + 7;
                                }
                                else{
                                    invoiceLineItem.StartDate__c = WeekStartDate;
                                    invoiceLineItem.EndDate__c = WeekEndDate;
                                  
                                }
                                oliIli.add(new opportunityLineItemInvoiceLineItemWrapper(invoiceLineItem, olis));
                              
                            }

 

              }

 

 

 

Thanks in Advance...  :)

  • November 26, 2013
  • Like
  • 0

hi,

 

I want to split dates according to monthsBetween() start date and end date  and I'm confused so if any one has any of the solutions... than plz ... tell me... thanks in advance....  :)

 

  • November 06, 2013
  • Like
  • 0

hi,

 

I want to update a child object field when if opportunity line item 's quantity gets updated and that object which gonna be informed that the opportunity is got updated .... is the child to opportunity . so for that I'm writting a trigger and getting confused in fetching the old value of that field..... to match .in the if condition....

 

public void statusUpdate(List<opportunity> newOpps, List<opportunity> oldOpps){
        List<String> oppIds = new List<String>();
        List<opportunityLineItem> opportunityLineItemsNew = new List<opportunityLineItem>();
        List<production__c> productionTickets = new List<production__c>();
        for(opportunity oppNw : newOpps){
            oppids.add(oppNw.id);
        }
        
        opportunityLineItemsNew = [Select id, opportunityId, quantity, StartDate__c, EndDate__c, CostType__c From opportunityLineItem where opportunityID in : oppids];
        productionTickets = [select id, name, Opportunity__c, OpportunityStatus__c from production__c where Opportunity__c in : oppids];
        
        for(Production__c pt : productionTickets){
            for(opportunityLineItem oli : opportunityLIneItemsNew){
                if(oli.opportunityId == pt.opportunity__c){
                    if(oli.quantity != ?????? ){
                   
                    }
                }
            }
        }
    }

 

so plz tell me if you have any of the solutions.... thanks in advance........................... :)

  • October 15, 2013
  • Like
  • 0

HI there,

it's really confusing that how it is picking values by using {!filterId}
expression selectList component???

<apex:page standardController="Case" recordSetvar="cases">
    <apex:pageBlock >
        <apex:form id="theForm">
            <apex:panelGrid columns="2">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                </apex:selectList>
            </apex:panelGrid>
            <apex:pageBlockSection >
                <apex:dataList var="c" value="{!cases}" id="list">
                    {!c.subject}
                </apex:dataList>
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>
</apex:page>

if anyone knows it there than please update me..... thanks.. in advance :)

  • October 04, 2013
  • Like
  • 0

hi there,

friends I have a vf page that generating pdf and that page has a controller that is getting data from a master object and also from it's multiple child records using fieldsets the both objects having it's own fieldset and now when I'm doing

ApexPages.StandardController controller;
        productionEditControl proController = new productionEditControl(controller);
       
        //inserting test data... contains one production ticket and production line item under it...
        production__c p = new production__c();
        p.name = 'new test prodution 0011112';
        insert p;
       
        List<ProductionLineItem__c> plis = new List<ProductionLineItem__c>();
        for(Integer i = 0; i<=3; i++){
            productionLineItem__c pli = new productionLineItem__c();
            pli.production__c = p.id;
            plis.add(pli);
        }
        insert plis;
       
        // now passing the id to related page to use that data inserted above...
        PageReference pageRef = Page.EditProductionTicket;
        pageRef.getParameters().put('id', p.id);
        Test.setCurrentPage(pageRef);
       
        // calling instance methods...
        proController.save();
        proController.cancel();


it's giving me an error saying .... List has no rows for assignment to SObject so please tell me how to solve it..

 

thanks in advance.....

  • October 02, 2013
  • Like
  • 0