+ Start a Discussion
TaddTadd 

I need help creating a visualforce page that returns a table of filtered data from opportunities

I want to create a list of opportunities on a visualforce page so I can add them to our dashboard.
venkat-Dvenkat-D
VIsualforce page has limitation on no of records it can display . Limit is 1000. beyond that you need to use paginiation. 
You can use pageblock table to display records if you are sure that count will be less than 1000 

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageBlockTable.htm
Mahesh DMahesh D
Hi Tadd,

In addition to Venky's comments, please go through the below link to make it editable list:

http://mwelburn.github.io/Visualforce-Edit-Multiple-Records/

if you don't want to edit it, just to display then you can use PageBlockTable example and retrieve the results;

Sample code for PageBlockTable is:
 
<apex:page standardController="Account">
    <apex:pageBlock title="List of Contacts">
        <apex:pageBlockTable value="{!Account.Contacts}" var="acc">
            <apex:column value="{!acc.Name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
Along with Venky's link, you can also look into below options:

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_iteration_components.htm
http://salesforce.stackexchange.com/questions/44310/creating-visualforce-pageblocktable-with-custom-object-table-not-appearing

This one will shows you different other components to display table kind of output.

http://www.thephani.com/difference-between-pageblocktabe-datatable-repeat/

Please let me know if this helps you.

Regards,
Mahesh
 
TaddTadd
Forgive my ignorance on the subject, I am not very experienced with VisualForce. Below is the table I would like to have on a VF page.

User-added image
Based on your help I came up with the following which returns a blank page:

<apex:page standardController="Opportunity">

    <apex:pageBlock title="Work Ticket Status">

        <apex:pageBlockTable value="{!Opportunity}" var="Work_Ticket_Status__c">

            <apex:column value="{!Work_Ticket_Status__c}"/> 

        </apex:pageBlockTable> 

    </apex:pageBlock> 

</apex:page>
Mahesh DMahesh D
If you want to retrieve list of Opportunities from the Org:
 
<apex:page standardController="Opportunity" tabStyle="Opportunity" extensions="OpportunityExtController">

    <apex:form>
        <apex:pageMessages/>
        <apex:pageblock id="CustomList" title="Related Opportunities"  >
            <apex:pageBlockTable value="{!oppList}" var="o" rendered="{!NOT(ISNULL(oppList))}">
             <apex:column value="{!o.Name}"/>
             <apex:column value="{!o.Account.Name}"/>
             <apex:column value="{!o.Type}"/>
             <apex:column value="{!o.Amount}"></apex:column>
             <apex:column value="{!o.CloseDate}"/>
            </apex:pageBlockTable>
            <apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppList))}" styleClass="noRowsHeader">
            </apex:outputLabel>
        </apex:pageblock>
    </apex:form>
</apex:page>
 
public class OpportunityExtController {
    public List<Opportunity> oppList {get; set;}
    public OpportunityExtController(ApexPages.StandardController controller) {
        oppList = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity];
    }
}

Please do let me know if it helps.

Regards,
Mahesh

 
TaddTadd
Can you help me recreate the example listed on SF.com below using the following fields from my Opportunities?
I need three columns where the example only has two, the opportunity fields are "Work_Ticket__c" "Name" and "Questions_and_Comments__c"


https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_advanced_dashboard_components.htm