• Rakesh Sahoo
  • NEWBIE
  • 0 Points
  • Member since 2013

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

I want to display the map-key in the header and map-value in data in visulforce page, how can i do this help me.

<apex:page controller="RMDKChart1CountryAllRevenue" tabStyle="Opportunity" sidebar="false">
<apex:pageBlock >
<apex:pageBlockSection title="Revnue Type - Hire">
    <apex:pageBlockTable value="{!MyReportHireData}" var="r" title="Report data">
    <!-- <apex:column value="{!r.os.OpportunityLineItem.Opportunity.Id}"/>
    <apex:column value="{!r.os.OpportunityLineItem.PricebookEntry.Name}"/> -->
    <apex:column value="{!r.os.OpportunityLineItem.Opportunity.Name}"/>
    <apex:column value="{!r.os.OpportunityLineItem.Opportunity.Account.Name}"/>
    <apex:column value="{!r.os.OpportunityLineItem.Opportunity.Probability}"/>
    <apex:column value="{!r.os.OpportunityLineItem.Opportunity.OwnerID}"/>
    <apex:repeat value="{!r.mpkeys}" var="month">
     <apex:column headerValue="{!month}">
    <apex:outputText value="{!r.MonthMap[month]}"/>
    </apex:column>
    </apex:repeat>
    <!--  <apex:column value="{!r.MonthMap}"/> -->
    </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:page>

 COntroller---

public with sharing class RMDKChart1CountryAllRevenue
{
    public list<OpportunityLineItemSchedule> oppSchList = new list<OpportunityLineItemSchedule>();
    public map<Id,MyReport> myReportHireMap = new map<Id,MyReport>();
    public list<OpportunityLineItemSchedule> getoppSchList()
    {
        return oppSchList;
    }
    public list<MyReport> getMyReportHireData()
    {
        return myReportHireMap.values();
    }
    public class MyReport
    {
        Public OpportunityLineItemSchedule os {get;set;}
        Public Map<Integer, Decimal> monthMap{get;set;}
        public MyReport(OpportunityLineItemSchedule ops,Map<Integer, Decimal> mp)
        {
            os = ops;
            monthMap = mp;
        }
    }
 public RMDKChart1CountryAllRevenue()
    {   
        //For Hire
        oppSchList = [Select OpportunityLineItem.Opportunity.Id, ScheduleDate,OpportunityLineItem.Opportunity.Name,OpportunityLineItem.Opportunity.Account.Name, OpportunityLineItem.PricebookEntry.Name,OpportunityLineItem.Opportunity.Sales_Region__c,OpportunityLineItem.Opportunity.Phase_Detail__c,OpportunityLineItem.Opportunity.Revenue_Start_Date__c,OpportunityLineItem.Opportunity.Revenue_End_Date__c, Revenue,OpportunityLineItem.Opportunity.StageName, OpportunityLineItem.Opportunity.Probability, OpportunityLineItem.Opportunity.OwnerID From OpportunityLineItemSchedule where CALENDAR_YEAR(ScheduleDate)=2013 and OpportunityLineItem.PricebookEntry.Name = 'Hire' order by scheduleDate];   
        
        for(OpportunityLineItemSchedule os : oppSchList)
        {
            if(!myReportHireMap.containsKey(os.OpportunityLineItem.Opportunity.Id))
            {
                Map<Integer,Decimal> monthMap = new Map<Integer, Decimal>{1=>0,2=>0,3=>0,4=>0,5=>0,6=>0,7=>0,8=>0,9=>0,10=>0,11=>0,12=>0};
                monthMap.put((os.ScheduleDate).month(),os.revenue);
                MyReport myr = new Myreport(os,monthMap);
                myReportHireMap.put(os.OpportunityLineItem.Opportunity.Id,myr);
                
            }
            else
            {
                myReportHireMap.get(os.OpportunityLineItem.Opportunity.Id).monthMap.put((os.ScheduleDate).month(),os.revenue);
            }
            
        }
    }

}

 

I executed the following related soql query in salesforce workbench:

select ACT_STATUS_ABT__C, ACCOUNT__R.Name from ACT_STATUS__C where ACT_STATUS_ABT__C != NULL

Here ACT_STATUS__C is the child object of the account (i.e there is a master detail relationship to the account). 

 

This query is working perfectly in the Apex Explorer, But When I execute the same query in the salesforce workbench I am getting the following error: 

 

Parent relationship queries are not allowed. 

 

What could be the reason? The API version of workbench I am using is 22.0

 

 

  • October 07, 2011
  • Like
  • 0