function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Geoff SpozettaGeoff Spozetta 

List Display Custom Object ApexPages.StandardSetController

Hi All,

I've been following a Tutorial on Apex Code development and what I'm looking to acheive is to provide a list of  order information from a custom object. The error I'm currently running into is:
Error: Unknown property 'ApexPages.StandardSetController.Location_ID__c'

My Controller:
 
public class InnovationOrderingController {
//ApexPages.StandardSetController must be instantiated
//For standard list controllers
	public ApexPages.StandardSetController orderdets {
		get{
		if(orderdets == null) {
			orderdets = new ApexPages.StandardSetController(Database.getQueryLocator(
			[SELECT 
			Additional_Comments__c,
			Construction_Type__c,
			Contract_Signed_Date__c,
			CSA_ID__c,
			customer_site_id__c,
			Location_ID__c,
			Order_Completion_Date__c,
			Order_Status__c,
			Order_Type__c,
			Product_Instance_Number__c,
			Requested_Speed__c,
			Requested_Start_Date__c,
			Service_Status__c,
			site_name__c
			FROM innovation_orders__c]));
	}
	return orderdets;
	}
	set;
	}
//Initalize orderdets and return a list of records
	public List<innovation_orders__c> getOrderDets() {
		return (List<innovation_orders__c>) orderdets.getRecords();
	}
}
My page:
 
<apex:page controller="InnovationOrderingController">
    <apex:pageBlock title = "Congration">
        <apex:pageblockSection columns="1">
        
            <apex:pageBlockTable value="{!orderdets}" var="order" >
                <apex:datalist var="o" value="{!order.Location_ID__c}"/>
                
            </apex:pageBlockTable>
        </apex:pageblockSection>
        
    </apex:pageBlock>
</apex:page>






 
pconpcon
This is because Visualforce is getting confused as to which method to call.  If you rename line 04 to be orderSetController and then change line 31 to say orderSetController.getRecords();
Amit Chaudhary 8Amit Chaudhary 8
Please update your class like below.
public class InnovationOrderingController {
//ApexPages.StandardSetController must be instantiated
//For standard list controllers
	public ApexPages.StandardSetController orderSetCont {
		get{
		if(orderSetCont == null) {
			orderSetCont = new ApexPages.StandardSetController(Database.getQueryLocator(
			[SELECT 
			Additional_Comments__c,
			Construction_Type__c,
			Contract_Signed_Date__c,
			CSA_ID__c,
			customer_site_id__c,
			Location_ID__c,
			Order_Completion_Date__c,
			Order_Status__c,
			Order_Type__c,
			Product_Instance_Number__c,
			Requested_Speed__c,
			Requested_Start_Date__c,
			Service_Status__c,
			site_name__c
			FROM innovation_orders__c]));
	}
	return orderSetCont;
	}
	set;
	}
//Initalize orderSetCont and return a list of records
	public List<innovation_orders__c> getOrderDets() {
		return (List<innovation_orders__c>) orderSetCont.getRecords();
	}
}
Please let us know if this will help you

Thanks
Amit Chaudhary
Geoff SpozettaGeoff Spozetta
Hi Amit,

I've updated the class as per your instructions and I'm still running into the same error:

Error: Unknown property 'ApexPages.StandardSetController.Location_ID__c'

 
Amit Chaudhary 8Amit Chaudhary 8
Please update your VF page like below :-
<apex:page controller="InnovationOrderingController">
    <apex:pageBlock title = "Congration">
        <apex:pageblockSection columns="1">
        
            <apex:pageBlockTable value="{!orderdets}" var="order" >
				<apex:column value="{!order.Location_ID__c }"  />
            </apex:pageBlockTable>
			
        </apex:pageblockSection>
        
    </apex:pageBlock>
</apex:page>
Please let us know if that will help you

Thanks
AMit Chaudhary