Skip to main content
added 86 characters in body
Source Link
Ryan T
  • 95
  • 1
  • 4
  • 12

After much further research on what I was doing wrong, (and with the initial help of Daniel to figure out what I was missing with __c ) I figured out that the custom fields just won't render in a visualforce page on my edition of salesforce, without the fields themselves being present in page layout first. (that, to me, is redundant and not at all what I'm looking for) So I took a different approach.

As we do not have sales data in there as of yet, I created 12 fields under Opportunities, and put them on the page layout in there, and then named each opportunity under an account, the year of the sales data i'm inputting.

here is my code,

<apex:page standardController="Account" sidebar="false">
<apex:form >
<apex:pageBlock >

  <apex:pageBlockTable Columns="14" value="{!Account.Opportunities}" var="opp">

    <apex:column headerValue="Year" value="{!opp.Name}"/>
    <apex:column headerValue="Jan" value="{!opp.Jan__c}"/>
    <apex:column headerValue="Feb" value="{!opp.Feb__c}"/>
    <apex:column headerValue="Mar" value="{!opp.Mar__c}"/>
    <apex:column headerValue="Apr" value="{!opp.Apr__c}"/>
    <apex:column headerValue="May" value="{!opp.May__c}"/>
    <apex:column headerValue="Jun" value="{!opp.Jun__c}"/>
    <apex:column headerValue="Jul" value="{!opp.Jul__c}"/>
    <apex:column headerValue="Aug" value="{!opp.Aug__c}"/>
    <apex:column headerValue="Sep" value="{!opp.Sep__c}"/>
    <apex:column headerValue="Oct" value="{!opp.Oct__c}"/>
    <apex:column headerValue="Nov" value="{!opp.Nov__c}"/>
    <apex:column headerValue="Dec" value="{!opp.Dec__c}"/>
    <apex:column headerValue="Total" value="{!opp.Sum__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Name is the 'year' that these sales are being reported for. Sum is a formula field adding up the 12 month fields.

Each year that is entered as an 'opportunity' under an account will automatically be shown in this table as a new row.

The only issue i've ran into now is how to control the order in which they appear.

After much further research on what I was doing wrong, (and with the initial help of Daniel to figure out what I was missing with __c ) I figured out that the custom fields just won't render in a visualforce page on my edition of salesforce, without the fields themselves being present in page layout first. (that, to me, is redundant and not at all what I'm looking for) So I took a different approach.

As we do not have sales data in there as of yet, I created 12 fields under Opportunities, and put them on the page layout in there, and then named each opportunity under an account, the year of the sales data i'm inputting.

here is my code,

<apex:page standardController="Account" sidebar="false">
<apex:form >
<apex:pageBlock >

  <apex:pageBlockTable Columns="14" value="{!Account.Opportunities}" var="opp">

    <apex:column headerValue="Year" value="{!opp.Name}"/>
    <apex:column headerValue="Jan" value="{!opp.Jan__c}"/>
    <apex:column headerValue="Feb" value="{!opp.Feb__c}"/>
    <apex:column headerValue="Mar" value="{!opp.Mar__c}"/>
    <apex:column headerValue="Apr" value="{!opp.Apr__c}"/>
    <apex:column headerValue="May" value="{!opp.May__c}"/>
    <apex:column headerValue="Jun" value="{!opp.Jun__c}"/>
    <apex:column headerValue="Jul" value="{!opp.Jul__c}"/>
    <apex:column headerValue="Aug" value="{!opp.Aug__c}"/>
    <apex:column headerValue="Sep" value="{!opp.Sep__c}"/>
    <apex:column headerValue="Oct" value="{!opp.Oct__c}"/>
    <apex:column headerValue="Nov" value="{!opp.Nov__c}"/>
    <apex:column headerValue="Dec" value="{!opp.Dec__c}"/>
    <apex:column headerValue="Total" value="{!opp.Sum__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Name is the 'year' that these sales are being reported for. Sum is a formula field adding up the 12 month fields.

Each year that is entered as an 'opportunity' under an account will automatically be shown in this table as a new row.

After much further research on what I was doing wrong, (and with the initial help of Daniel to figure out what I was missing with __c ) I figured out that the custom fields just won't render in a visualforce page on my edition of salesforce, without the fields themselves being present in page layout first. (that, to me, is redundant and not at all what I'm looking for) So I took a different approach.

As we do not have sales data in there as of yet, I created 12 fields under Opportunities, and put them on the page layout in there, and then named each opportunity under an account, the year of the sales data i'm inputting.

here is my code,

<apex:page standardController="Account" sidebar="false">
<apex:form >
<apex:pageBlock >

  <apex:pageBlockTable Columns="14" value="{!Account.Opportunities}" var="opp">

    <apex:column headerValue="Year" value="{!opp.Name}"/>
    <apex:column headerValue="Jan" value="{!opp.Jan__c}"/>
    <apex:column headerValue="Feb" value="{!opp.Feb__c}"/>
    <apex:column headerValue="Mar" value="{!opp.Mar__c}"/>
    <apex:column headerValue="Apr" value="{!opp.Apr__c}"/>
    <apex:column headerValue="May" value="{!opp.May__c}"/>
    <apex:column headerValue="Jun" value="{!opp.Jun__c}"/>
    <apex:column headerValue="Jul" value="{!opp.Jul__c}"/>
    <apex:column headerValue="Aug" value="{!opp.Aug__c}"/>
    <apex:column headerValue="Sep" value="{!opp.Sep__c}"/>
    <apex:column headerValue="Oct" value="{!opp.Oct__c}"/>
    <apex:column headerValue="Nov" value="{!opp.Nov__c}"/>
    <apex:column headerValue="Dec" value="{!opp.Dec__c}"/>
    <apex:column headerValue="Total" value="{!opp.Sum__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Name is the 'year' that these sales are being reported for. Sum is a formula field adding up the 12 month fields.

Each year that is entered as an 'opportunity' under an account will automatically be shown in this table as a new row.

The only issue i've ran into now is how to control the order in which they appear.

Source Link
Ryan T
  • 95
  • 1
  • 4
  • 12

After much further research on what I was doing wrong, (and with the initial help of Daniel to figure out what I was missing with __c ) I figured out that the custom fields just won't render in a visualforce page on my edition of salesforce, without the fields themselves being present in page layout first. (that, to me, is redundant and not at all what I'm looking for) So I took a different approach.

As we do not have sales data in there as of yet, I created 12 fields under Opportunities, and put them on the page layout in there, and then named each opportunity under an account, the year of the sales data i'm inputting.

here is my code,

<apex:page standardController="Account" sidebar="false">
<apex:form >
<apex:pageBlock >

  <apex:pageBlockTable Columns="14" value="{!Account.Opportunities}" var="opp">

    <apex:column headerValue="Year" value="{!opp.Name}"/>
    <apex:column headerValue="Jan" value="{!opp.Jan__c}"/>
    <apex:column headerValue="Feb" value="{!opp.Feb__c}"/>
    <apex:column headerValue="Mar" value="{!opp.Mar__c}"/>
    <apex:column headerValue="Apr" value="{!opp.Apr__c}"/>
    <apex:column headerValue="May" value="{!opp.May__c}"/>
    <apex:column headerValue="Jun" value="{!opp.Jun__c}"/>
    <apex:column headerValue="Jul" value="{!opp.Jul__c}"/>
    <apex:column headerValue="Aug" value="{!opp.Aug__c}"/>
    <apex:column headerValue="Sep" value="{!opp.Sep__c}"/>
    <apex:column headerValue="Oct" value="{!opp.Oct__c}"/>
    <apex:column headerValue="Nov" value="{!opp.Nov__c}"/>
    <apex:column headerValue="Dec" value="{!opp.Dec__c}"/>
    <apex:column headerValue="Total" value="{!opp.Sum__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Name is the 'year' that these sales are being reported for. Sum is a formula field adding up the 12 month fields.

Each year that is entered as an 'opportunity' under an account will automatically be shown in this table as a new row.