You need to sign in to do that
Don't have an account?
Compile Error: unexpected token: '{' at line 2 column 43
hi, here Iam trying to implement some apex code for display dashdoard
through vf pages. while compiling the apex class i got the error unexpected token
here iam attaching apex class code and vf page code. please any one can clear this error
public class OppsController {
publicApexPages.StandardSetControllersetCon{
get {
if(setCon == null) {
setCon = newApexPages.StandardSetController(Database.getQueryLocator(
[SELECT name, type, amount, closedate FROM Opportunity]));
setCon.setPageSize(5);
}
returnsetCon;
}
set;
}
public List<Opportunity>getOpportunities() {
return (List<Opportunity>) setCon.getRecords();
}
}
vf page code
<apex:page controller="OppsController">
<apex:chart data="{!Opportunities}" width="600" height="400">
<apex:axis type="Category" position="left" fields="Name" title="Opportunities"/>
<apex:axis type="Numeric" position="bottom" fields="Amount" title="Amount"/>
<apex:barSeries orientation="horizontal" axis="bottom"xField="Name"yField="Amount"/>
</apex:chart>
<apex:dataTable value="{!Opportunities}"var="opp">
<apex:column value="{!opp.name}"/>
<apex:column value="{!opp.amount}"/>
</apex:dataTable>
</apex:page>
may be you would like to add some spaces ;)
All Answers
may be you would like to add some spaces ;)
Copy Paste this code and check
public class OppsController {
public ApexPages.StandardSetController setCon{
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT name, type, amount, closedate FROM Opportunity]));
setCon.setPageSize(5);
}
return setCon;
}
set;
}
public List<Opportunity> getOpportunities() {
return (List<Opportunity>) setCon.getRecords();
}
}
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
thank u
it is working