• sai sandeep chilakapati
  • NEWBIE
  • -2 Points
  • Member since 2016

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

I'm attempting to code a list and I have the above error showing up whenever i attempt to compile the class.  Can anyone spot what Is wrong and tell me how to fix it?

 

Here's my page:

<apex:page standardController="SFDC_Purchase_Order__c" extensions="AttachPRTOPOController" action="{!initList}">
    <apex:form >
        <apex:pageBlock tabStyle="SFDC_Purchase_Order__c" >
             <apex:pageBlockTable value="{!resultList}" var="r"
                        id="resultsBlock" columns="9" width="20%">
                    // rendered="{!NOT(ISNULL(resultList))}">
                        <apex:column headerValue="PR No." width="5%">
                            <apex:outputLink value="/{!r.id}?retURL={$currentPage.URL}">{!r.Name}</apex:outputLink>
                        </apex:column>
                        <apex:column value="{!r.status__c}"
                            headerValue="Status" width="5%" />"
                        <apex:column value="{!r.status__c}"
                            headerValue="Type" width="10%" />
                        <apex:column value="{!r.RecordType__c}"
                            headerValue="Item" width="5%" />
                        <apex:column value="{!r.Item_Requested__c}"
                            headerValue="new Item Description" width="15%" />
                        <apex:column value="{!r.New_Item_Description__c}"
                            headerValue="Quantity" width="15%" />
                        <apex:column value="{!r.Quantity__c}"
                            headerValue="Requested By" width="10%" />
                        <apex:column value="{!r.CreatedDate}" headerValue="Created On"
                            width="10%" />
                        <apex:column value="{!r.CreatedBy.name}" headerValue="Requested By"
                            width="15%" />
                    </apex:pageBlockTable>
                </apex:pageBlock>
            </apex:form>
</apex:page>

 and here is my class:

public with sharing class AttachPRTOPOController {
     
    private final SFDC_Purchase_Order__c myPO;
    public final string myUser = UserInfo.getUserID();
    public final PageReference myParentPage = ApexPages.currentPage();
    public List<tempPR> resultList {get;set;}
    public List<SFDC_Purchase_Requisition__c> castRequestList {get; set;}
   	public AttachPRTOPOController(ApexPages.StandardController con) {
        this.myPO = (SFDC_Purchase_Order__c)con.getRecord();
       }
   
    public PageReference initList(){
       
        if(resultList == null  || resultList.size()<1) {
            resultList = new List<tempPR>();
        }
        System.debug('*************************************************starting InitList resultList = ' + resultList.size());
            string inputVar = ApexPages.currentPage().getParameters().get('id');
            System.debug('*************************************************************************************************Inside initList now');
             string qry = 'SELECT id, Name, Department__c, Status__c,RecordType Request_Date__c,SFDC_Purchase_Requisition__r.Item_Requsted__c, New_Item_Description__c,' 
                 + 'Quantity__c from SFDC_Purchase_Requisition__c where Purchaser__c.id = :myUser order by name asc limit 200';
            castRequestList = Database.query(qry);
            System.debug('castAccountList = ' + castRequestList + 'size = ' + castRequestList.size());
           
            for(SFDC_Purchase_Requisition__c myPR :  castRequestList) {
                resultList.add(new tempPR(myPR));
                System.debug('**********************************************************************************Building castAccountList myPR = ' + myPR);
             }
        return null;
    }
    
    public List<tempPR> getRequests() {
        if(resultList == null) {
            System.debug('**********************************************************************************************Inside getAccounts resultList = null');
                initList();
        }else{
            resultList.clear();
         }
       System.debug('**************************************************************************************resultList returned from getAccounts' + resultList);
        return resultList;
    }

    public PageReference processSelected() {
        System.debug('****************************************************************************************************Entered processSelected');
        
        for(tempPR tPR : getRequests()) {
            if(tPR.selected) {
                system.debug('******************************************at selectedAccount constructed: ' + tPR);
                system.debug('******************************************resultList = ' + resultList);
                resultList.add(tPR);
            }
         }
        return null;
    }
           
       public class tempPR {
            public SFDC_Purchase_Requisition__c request {get; set;}
            public Boolean selected {get; set;}

        public tempPR() {
        }

        public tempPR(SFDC_Purchase_Requisition__c req1) {
            request = req1;
            selected = false;
            
        }
    }
    
}

 Since I'm not very experienced, I know there are probably other problems with my code, but this is the one I'm having no luck in solving on my own.  I've tried replacing the quotes in the <apex:page> code with single quotes (didn't work, of course, since visualforce requires the double  quotes) and using a plain text editor to insert double quotes (char 34) over the double quotes that are there. I would be very grateful for any help anyone can offer.

 

Thank you in advance,

kathybb

:

 

Hello Everyone

 

Any help would be greatly appreciated

 

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<Product_Detail__c> at line 274 column 24

 

  public string SelectedAccountId { get; set; }
     public void DeleteDetail()
   {
    // if for any reason we are missing the reference
      if (SelectedAccountId == null) {     
         return;
      }
    
      // find the detail record within the collection
      Product_Detail__c tobeDeleted = null;
     
      for(List<Product_Detail__c> a : products.values())
     // for(Product_Detail__c a : products)
       if (a.name = SelectedAccountId) {
         tobeDeleted = a.name;    <<<<<<Line 274
          break;         
        }     
      //if account record found delete it
      if (tobeDeleted != null) {
       Delete tobeDeleted;
      }
    
      //refresh the data
      //LoadData();
   }   

  • July 19, 2012
  • Like
  • 0