thanks for your reply but i have already done this
global with sharing class DashPortalController{ public static List<CaseFailBean> listCaseFailBean{get;set;}
@RemoteAction global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){ listCaseFailBean= new List<CaseFailBean>(); CaseFailBean beanObj=new CaseFailBean(AccId,WasteColl,DaysColl,ServiceSuccessRate,ServiceFailureRate); listCaseFailBean.add(beanObj); } global class CaseFailBean{ public String AccName{get;set;} public String WasteName{get;set;} public String DaysTotal{get;set;} public Decimal totalCases{get;set;} public Decimal totalServiceColl{get;set;}
IF you dont need Remoteaction than use constructor otherwise call the loadCustomerServiceSuccessRate(String dateFrom) from constructor.Try it.and let me know
global with sharing class DashPortalController
{ public static List<CaseFailBean> listCaseFailBean{get;set;}
public DashPortalController()
{
loadCustomerServiceSuccessRate(anyData); }
@RemoteAction
global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){ listCaseFailBean= new List<CaseFailBean>(); CaseFailBean beanObj=new CaseFailBean("AccId","WasteColl","DaysColl",ServiceSuccessRate,ServiceFailureRate); listCaseFailBean.add(beanObj); }
Apex Code:
public class a
{
public w var {get;set}
//wrapper class
public class w
{
public String str;
}
}
Visualforce page:
<apex:outputText value="{!var.str}"/>
Regards,
Magulan D
Salesforce.com certified Force.com Developer.
SFDC Blog
If this post is your solution, kindly mark this as the solution.
thanks for your reply but i have already done this
global with sharing class DashPortalController{
public static List<CaseFailBean> listCaseFailBean{get;set;}
@RemoteAction
global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){
listCaseFailBean= new List<CaseFailBean>();
CaseFailBean beanObj=new CaseFailBean(AccId,WasteColl,DaysColl,ServiceSuccessRate,ServiceFailureRate);
listCaseFailBean.add(beanObj);
}
global class CaseFailBean{
public String AccName{get;set;}
public String WasteName{get;set;}
public String DaysTotal{get;set;}
public Decimal totalCases{get;set;}
public Decimal totalServiceColl{get;set;}
public CaseFailBean(String Name,String WasteType,String TotalDays,Decimal ServiceSuccessRate,Decimal ServiceFailureRate){
this.AccName= Name;
this.WasteName= WasteType;
this.DaysTotal= TotalDays;
this.totalServiceColl=ServiceSuccessRate;
this.totalCases=ServiceFailureRate;
}
public CaseFailBean(){
}
}
==========================VisualForce Page====================
<apex:page controller="DashPortalController" readonly="true" contentType="application/vnd.ms-excel" language="en-US">
<apex:pageBlock >
<apex:pageBlockTable value="{!listCaseFailBean}" var="bl">
<apex:column headerValue="Account Name">
<apex:outputText value="{!bl.AccName}"/>
</apex:column>
<apex:column headerValue="Waste Name">
<apex:outputText value="{!bl.WasteName}"/>
</apex:column>
<apex:column headerValue="DaysTotal">
<apex:outputText value="{!bl.DaysTotal}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
the problem is, in VF page when i click export to csv then CSV file only shows Header name that i have used in
<apex:column headerValue="">
but not showing the values
Dont use pageblock and other tags for export.... Thats y u r getting the error... think so... My suggestion is try without using tags
http://infallibletechie.blogspot.in/2012/08/export-using-apex-code-in-salesforce.html
Check this link...
Regards,
Magulan D
Salesforce.com certified Force.com Developer.
SFDC Blog
If this post is your solution, kindly mark this as the solution.
it is not showing the values but displays the header
like Account Name Waste Type
Hi
Your list listCaseFailBean is empty,because you have not call method loadCustomerServiceSuccessRate(String dateFrom).
Or you can simply create list in the constructor of mail class as shown below
global with sharing class DashPortalController
{
public static List<CaseFailBean> listCaseFailBean{get;set;}
public DashPortalController()
{
CaseFailBean beanObj=new CaseFailBean("some","WasteColl","DaysColl",0,0);
listCaseFailBean.add(beanObj);
}
}
Try it and let me know whether it works or not??
Thanks
Anil
i have declared CaseFailBean beanObj in @remoteaction, how can i call it in constructor DashPortalController()
public DashPortalController()
{
}
IF you dont need Remoteaction than use constructor otherwise call the loadCustomerServiceSuccessRate(String dateFrom) from constructor.Try it.and let me know
global with sharing class DashPortalController
{
public static List<CaseFailBean> listCaseFailBean{get;set;}
public DashPortalController()
{
loadCustomerServiceSuccessRate(anyData);
}
@RemoteAction
global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){
listCaseFailBean= new List<CaseFailBean>();
CaseFailBean beanObj=new CaseFailBean("AccId","WasteColl","DaysColl",ServiceSuccessRate,ServiceFailureRate);
listCaseFailBean.add(beanObj);
}
}
hii anil
i have tried this but it is giving error: Attempt to De-refernce null object
public DashPortalController()
{
loadCustomerServiceSuccessRate(anyData); // Giving Error
}
Nisha
if its possible send me the full code of class and page.
please check your private message