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
Irvine DelacroixIrvine Delacroix 

Populate Object Records using Visualforce

Hello,

Just trying to figure out how to populate the Object Records to visualforce. This is my first day with the visualforce and it got my interest.

My code doen't seem to work (Not sure if I'm doing it right or if I'm missing something). Can anyone please give me an Idea about what I'm trying to do? or is this something that a begginer should not start with.

My Code:

<apex:page standardController="Replicate__c" > 
        <apex:pageBlock title="Replicate Records">
            <apex:pageBlockTable value="{!Replicate__c}" var="Rep">
                <apex:column value="{!Rep.name}"/>                        
            </apex:pageBlockTable>                         
        </apex:pageBlock>
</apex:page>

What I'm expecting it to do is that if I run the visualforce page, it will output like a list view. But is shows something like the picture below.

Output

Thank you! :)
bob_buzzardbob_buzzard
You are using a standard controller, which manages a single record and expects to be passed the id of that record on the URL.  It sounds like you want to use a standard list controller - this will display the records present in the last list view that you accessed.  Turning a standard controller into a standard list controller is simply a matter of defining the recordsetvar and iterating that:
 
<apex:page standardController="Replicate__c" recordsetvar="Reps"> 
        <apex:pageBlock title="Replicate Records">
            <apex:pageBlockTable value="{!Reps}" var="Rep">
                <apex:column value="{!Rep.name}"/>                        
            </apex:pageBlockTable>                         
        </apex:pageBlock>
</apex:page>
Irvine DelacroixIrvine Delacroix
Thank you Bob,

I think I need to start from the very basic before I would be able to anderstand how this really works. Thanks a lot! :)