-
ChatterFeed
-
1Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
4Replies
unable to solve this error
etting error : - Constructor not defined: need help
public class My_2nd_Api {
Public static void Insert_Records(){
List<Opportunity> oppbatch=[select id,name,stageName,Edition__r.name,Sub_Allocation_Name__r.name,Account.name,Account.Website,Account.BillingCountry,Account.BillingState,Account.BillingCity,Account.BillingStreet,Account.BillingPostalcode,(select Unique_id__c,Product_Sub_Category_New__c,stand_Number_s__c,Hall_s__c,Type_of_Stand__c,Stand_Depth__c,Stand_Width__c,
Contractual_Sq_M__c, Exhibitor_Id__c,Open_Sides__c from OpportunityLineItems), (Select contact.firstname,contact.lastname,contact.Email,contact.Phone,contact.Salutation from OpportunityContactRoles)
from Opportunity limit 10];
system.debug('oppbatch List query.. '+oppbatch);
List<OppWrapper> oppWrapperVarList = new List<OppWrapper>();
for(Opportunity opp : oppbatch)
{
system.debug('Chehking'+opp.OpportunityLineItems);
OppWrapper oppwrappervar= new OppWrapper(opp.id,opp.name,opp.StageName,opp.Edition__r.name,opp.Sub_Allocation_Name__r.name,opp.Account.name,opp.Account.Website, opp.Account.BillingCountry,opp.Account.BillingState,opp.Account.BillingCity,opp.Account.BillingStreet, opp.Account.BillingPostalcode);
for(OpportunityLineItem li : opp.OpportunityLineItems)
{
oppwrappervar(li.Unique_id__c,li.Product_Sub_Category_New__c,li.Stand_Number_s__c,li.Hall_s__c,li.Type_of_Stand__c,li.Stand_Depth__c,li.Stand_Width__c,li.Contractual_Sq_M__c);
}
for(OpportunityContactRole ocr : opp.OpportunityContactRoles)
{
oppwrappervar(ocr.contact.firstname,ocr.contact.lastname,ocr.contact.Email,ocr.contact.Phone,ocr.contact.Salutation);
}
oppWrapperVarList.add(oppwrappervar);
//OppWrapper oppwrappervar=new OppWrapper(oppbtch.Edition_Name__c,oppbtch.Opportunity_Id__c,oppbtch.Opportunity_Name__c,oppbtch.Opportunity_Stage__c,oppbtch.Stand_No__c,oppbtch.Banner_name__c);
//oppWrapperVarList.add(oppwrappervar);
}
string jsonbody=Json.serialize(oppWrapperVarList);
system.debug('Json body---->'+jsonbody);
Http http = new Http();
HttpRequest request = new HttpRequest();
//request.setEndpoint('http://fpdatamap.salesforceoutsourcing.in/api/FPDatas');
request.setEndpoint('http://sfdata.iqratechnology.com/api/sf_data');
request.setMethod('POST');
request.setHeader('Content-Type','application/json');
//request.setHeader('Content-Type','multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
//request.setHeader('Authorization','Bearer '+ AuthorizationToken);
//request.setBody('[{ "RecordId": "456","RecordName": "moosa traders pvt ltd / The Big 5 Construct Egypt 2018 / / 093061123", "EventName": "a2JD0000001ns6uMAA U", "RecordStage": "Test Stage Amjad","BannerName": "Test Banner Amjad","StandNo": "Test Stand Amjad"}]');
request.setBody(jsonbody);
HttpResponse response = http.send(request);
system.debug('Response body '+ response.getBody());
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
public class OppWrapper
{
public String SFDC_RecordID {get;set;}
public String SFDC_RecordName {get;set;}
public String SFDC_RecordStage {get;set;}
public String SFDC_EventName {get;set;}
public String Stan_Sub_Allocation_Name {get;set;}
public String Acount_Long_Name {get;set;}
public String Web_Site {get;set;}
public String Country {get;set;}
public String Country_State {get;set;}
public String City {get;set;}
public String Street {get;set;}
public String Post_code {get;set;}
public String SFDC_Record_Unique_ID {get;set;}
public String Product_Subcategory {get;set;}
public String Stand_no {get;set;}
public String Hall {get;set;}
public String Type_of_Stand {get;set;}
public Decimal Height {get;set;}
public Decimal Width {get;set;}
public Decimal Contractual_Sq_M {get;set;}
public String First_Name {get;set;}
public String Last_Name {get;set;}
public String Email {get;set;}
public String Mobile {get;set;}
public String Salutation {get;set;}
public OppWrapper(String SFDC_RecordID,String SFDC_RecordName,String SFDC_RecordStage,String SFDC_EventName,String Stan_Sub_Allocation_Name,
String Acount_Long_Name,String Web_Site,String Country,String Country_State,String City,String Street,String Post_code,
String SFDC_Record_Unique_ID,String Product_Subcategory,String Stand_no,String Hall,String Type_of_Stand,Decimal Height,
Decimal Width,Decimal Contractual_Sq_M,String First_Name,String Last_Name,String Email,String Mobile,String Salutation)
{
this.SFDC_RecordID =SFDC_RecordID;
this.SFDC_RecordName =SFDC_RecordName;
this.SFDC_RecordStage =SFDC_RecordStage;
this.SFDC_EventName=SFDC_EventName;
this.Stan_Sub_Allocation_Name=Stan_Sub_Allocation_Name;
this.Acount_Long_Name=Acount_Long_Name;
this.Web_Site=Web_Site;
this.Country=Country;
this.Country_State=Country_State;
this.City=City;
this.Street=Street;
this.Post_code=Post_code;
this.SFDC_Record_Unique_ID=SFDC_Record_Unique_ID;
this.Product_Subcategory=Product_Subcategory;
this.Stand_no=Stand_no;
this.Hall=Hall;
this.Type_of_Stand=Type_of_Stand;
this.Height=Height;
this.Width=Width;
this.Contractual_Sq_M=Contractual_Sq_M;
}
}
}
Getting error on bold line error is :-
Line 17: Constructor not defined: [My_2nd_Api.OppWrapper].<Constructor>(String, String, String, String, String, String, String, String, String, String, String)
Line 24 Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, Id, Decimal, Decimal, Decimal) from the type My_2nd_Api
Line 29 : Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, String) from the type My_2nd_Api
Can anyone please help me to solve this error it is urgent
public class My_2nd_Api {
Public static void Insert_Records(){
List<Opportunity> oppbatch=[select id,name,stageName,Edition__r.name,Sub_Allocation_Name__r.name,Account.name,Account.Website,Account.BillingCountry,Account.BillingState,Account.BillingCity,Account.BillingStreet,Account.BillingPostalcode,(select Unique_id__c,Product_Sub_Category_New__c,stand_Number_s__c,Hall_s__c,Type_of_Stand__c,Stand_Depth__c,Stand_Width__c,
Contractual_Sq_M__c, Exhibitor_Id__c,Open_Sides__c from OpportunityLineItems), (Select contact.firstname,contact.lastname,contact.Email,contact.Phone,contact.Salutation from OpportunityContactRoles)
from Opportunity limit 10];
system.debug('oppbatch List query.. '+oppbatch);
List<OppWrapper> oppWrapperVarList = new List<OppWrapper>();
for(Opportunity opp : oppbatch)
{
system.debug('Chehking'+opp.OpportunityLineItems);
OppWrapper oppwrappervar= new OppWrapper(opp.id,opp.name,opp.StageName,opp.Edition__r.name,opp.Sub_Allocation_Name__r.name,opp.Account.name,opp.Account.Website, opp.Account.BillingCountry,opp.Account.BillingState,opp.Account.BillingCity,opp.Account.BillingStreet, opp.Account.BillingPostalcode);
for(OpportunityLineItem li : opp.OpportunityLineItems)
{
oppwrappervar(li.Unique_id__c,li.Product_Sub_Category_New__c,li.Stand_Number_s__c,li.Hall_s__c,li.Type_of_Stand__c,li.Stand_Depth__c,li.Stand_Width__c,li.Contractual_Sq_M__c);
}
for(OpportunityContactRole ocr : opp.OpportunityContactRoles)
{
oppwrappervar(ocr.contact.firstname,ocr.contact.lastname,ocr.contact.Email,ocr.contact.Phone,ocr.contact.Salutation);
}
oppWrapperVarList.add(oppwrappervar);
//OppWrapper oppwrappervar=new OppWrapper(oppbtch.Edition_Name__c,oppbtch.Opportunity_Id__c,oppbtch.Opportunity_Name__c,oppbtch.Opportunity_Stage__c,oppbtch.Stand_No__c,oppbtch.Banner_name__c);
//oppWrapperVarList.add(oppwrappervar);
}
string jsonbody=Json.serialize(oppWrapperVarList);
system.debug('Json body---->'+jsonbody);
Http http = new Http();
HttpRequest request = new HttpRequest();
//request.setEndpoint('http://fpdatamap.salesforceoutsourcing.in/api/FPDatas');
request.setEndpoint('http://sfdata.iqratechnology.com/api/sf_data');
request.setMethod('POST');
request.setHeader('Content-Type','application/json');
//request.setHeader('Content-Type','multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
//request.setHeader('Authorization','Bearer '+ AuthorizationToken);
//request.setBody('[{ "RecordId": "456","RecordName": "moosa traders pvt ltd / The Big 5 Construct Egypt 2018 / / 093061123", "EventName": "a2JD0000001ns6uMAA U", "RecordStage": "Test Stage Amjad","BannerName": "Test Banner Amjad","StandNo": "Test Stand Amjad"}]');
request.setBody(jsonbody);
HttpResponse response = http.send(request);
system.debug('Response body '+ response.getBody());
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
public class OppWrapper
{
public String SFDC_RecordID {get;set;}
public String SFDC_RecordName {get;set;}
public String SFDC_RecordStage {get;set;}
public String SFDC_EventName {get;set;}
public String Stan_Sub_Allocation_Name {get;set;}
public String Acount_Long_Name {get;set;}
public String Web_Site {get;set;}
public String Country {get;set;}
public String Country_State {get;set;}
public String City {get;set;}
public String Street {get;set;}
public String Post_code {get;set;}
public String SFDC_Record_Unique_ID {get;set;}
public String Product_Subcategory {get;set;}
public String Stand_no {get;set;}
public String Hall {get;set;}
public String Type_of_Stand {get;set;}
public Decimal Height {get;set;}
public Decimal Width {get;set;}
public Decimal Contractual_Sq_M {get;set;}
public String First_Name {get;set;}
public String Last_Name {get;set;}
public String Email {get;set;}
public String Mobile {get;set;}
public String Salutation {get;set;}
public OppWrapper(String SFDC_RecordID,String SFDC_RecordName,String SFDC_RecordStage,String SFDC_EventName,String Stan_Sub_Allocation_Name,
String Acount_Long_Name,String Web_Site,String Country,String Country_State,String City,String Street,String Post_code,
String SFDC_Record_Unique_ID,String Product_Subcategory,String Stand_no,String Hall,String Type_of_Stand,Decimal Height,
Decimal Width,Decimal Contractual_Sq_M,String First_Name,String Last_Name,String Email,String Mobile,String Salutation)
{
this.SFDC_RecordID =SFDC_RecordID;
this.SFDC_RecordName =SFDC_RecordName;
this.SFDC_RecordStage =SFDC_RecordStage;
this.SFDC_EventName=SFDC_EventName;
this.Stan_Sub_Allocation_Name=Stan_Sub_Allocation_Name;
this.Acount_Long_Name=Acount_Long_Name;
this.Web_Site=Web_Site;
this.Country=Country;
this.Country_State=Country_State;
this.City=City;
this.Street=Street;
this.Post_code=Post_code;
this.SFDC_Record_Unique_ID=SFDC_Record_Unique_ID;
this.Product_Subcategory=Product_Subcategory;
this.Stand_no=Stand_no;
this.Hall=Hall;
this.Type_of_Stand=Type_of_Stand;
this.Height=Height;
this.Width=Width;
this.Contractual_Sq_M=Contractual_Sq_M;
}
}
}
Getting error on bold line error is :-
Line 17: Constructor not defined: [My_2nd_Api.OppWrapper].<Constructor>(String, String, String, String, String, String, String, String, String, String, String)
Line 24 Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, Id, Decimal, Decimal, Decimal) from the type My_2nd_Api
Line 29 : Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, String) from the type My_2nd_Api
Can anyone please help me to solve this error it is urgent
-
- Iqra Tech
- May 29, 2019
- Like
- 0
How to track my sandbox org
Hi!..
Today I'm Facing a Very Big Issue In my Sandbox Org i.e. I;m not changing any class but some class shows last modified by my name.
and I'm already unchecking eclipse tooling api tool.but still change in some classes last modifide by my name.
Today I'm Facing a Very Big Issue In my Sandbox Org i.e. I;m not changing any class but some class shows last modified by my name.
and I'm already unchecking eclipse tooling api tool.but still change in some classes last modifide by my name.
-
- Adarsh Sharma 4
- September 13, 2016
- Like
- 0
selectRadio and checkbox with custom Pagination?
Hi,all I'm create simple custom pagination vf page .now I'm facing a problem ,when i'm check radio button all check box are selected
please help for this
vf page::::
<apex:page Controller="simpleCustomPagination11">
<div style="padding-top:20px;">
<apex:actionstatus id="DeleteStaus1">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">Delete...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</div>
<script type='text/javascript'>
function runOnEnter(ev) {
if (window.event && window.event.keyCode == 13 || ev.which == 13) {
searchAccRecs();
return false;
} else {
return true;
}
}
function checkAll(cb) {
var inputElem = document.getElementsByTagName("input");
for (var i = 0; i < inputElem.length; i++) {
if (inputElem[i].id.indexOf("checkedone") != -1)
inputElem[i].checked = cb.checked;
}
}
</script>
<apex:form id="form" >
<apex:actionFunction name="searchAccRecs" action="{!doSearch}" reRender="block" />
<apex:pageBlock title="Search" mode="edit" id="block">
<apex:pagemessages />
<span>
<apex:commandlink value="A|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="A" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="B |" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="B" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="C|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="C" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="D|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="D" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="E|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="E" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="F|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="F" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="G|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="G" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="H|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="H" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="I|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="I" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="J |" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="J" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="K|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="K" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="L|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="L" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="M|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="M" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="N|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="N" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="O|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="O" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="P|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="P" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Q|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Q" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="R|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="R" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="S|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="S" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="T|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="T" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="U|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="U" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="V|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="V" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="W|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="W" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="X|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="X" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Y|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Y" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Z|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Z" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Account Name</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}" onkeypress="return runOnEnter(event);" />
<apex:commandButton value="Search" action="{!doSearch}" id="searchBtn" status="searchStaus" rerender="block" />
<apex:actionstatus id="searchStaus">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">searching...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Results" id="results" columns="1" rendered="{!IF(accounts.size != null && accounts.size > 0, true , false)}">
<apex:pageBlockTable value="{!lstacc}" var="l">
<apex:column >
<apex:facet name="header">
<apex:selectRadio onclick="checkAll(this)">
</apex:selectRadio>
</apex:facet>
<apex:selectRadio id="Radiodone">
</apex:selectRadio>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this)">
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox id="checkedone">
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="Action" >
<apex:outputLink title="" value="/{!l.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
<a href="javascript:if (window.confirm('Are you sure?')) doDelete('{!l.Id}');" style="font-weight:bold">Del</a>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Account Name{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="name" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="Phone" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Phone}</apex:outputLink>
</apex:column>
<apex:column value="{!l.BillingCity}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing City{!IF(sortExpression=='BillingCity',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCity" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
<apex:column value="{!l.BillingCountry}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing Country{!IF(sortExpression=='BillingCountry',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCountry" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" rerender="results" action="{!First}" disabled="{!!hasPrevious}" />
<apex:commandButton value="<" rerender="results" action="{!Previous}" disabled="{!!hasPrevious}" />
<apex:commandButton value=">" rerender="results" action="{!Next}" disabled="{!!hasNext}" />
<apex:commandButton value=">|" rerender="results" action="{!Last}" disabled="{!!hasNext}" />
<apex:outputText >{!(pageno * 5)+1-5}-{!IF((pageno * 5)>count , count,(pageno * 5))} of {!count}</apex:outputText>
<br/>
<apex:outputText >Page
<apex:inputText value="{!pageno}" size="1" /> Of {!totalPages }</apex:outputText>
<apex:actionFunction action="{!doDelete}" name="doDelete" reRender="form" status="DeleteStaus1" >
<apex:param name="accountId" value="" assignTo="{!accountId}"/>
</apex:actionFunction>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
please help for this
vf page::::
<apex:page Controller="simpleCustomPagination11">
<div style="padding-top:20px;">
<apex:actionstatus id="DeleteStaus1">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">Delete...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</div>
<script type='text/javascript'>
function runOnEnter(ev) {
if (window.event && window.event.keyCode == 13 || ev.which == 13) {
searchAccRecs();
return false;
} else {
return true;
}
}
function checkAll(cb) {
var inputElem = document.getElementsByTagName("input");
for (var i = 0; i < inputElem.length; i++) {
if (inputElem[i].id.indexOf("checkedone") != -1)
inputElem[i].checked = cb.checked;
}
}
</script>
<apex:form id="form" >
<apex:actionFunction name="searchAccRecs" action="{!doSearch}" reRender="block" />
<apex:pageBlock title="Search" mode="edit" id="block">
<apex:pagemessages />
<span>
<apex:commandlink value="A|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="A" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="B |" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="B" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="C|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="C" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="D|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="D" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="E|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="E" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="F|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="F" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="G|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="G" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="H|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="H" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="I|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="I" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="J |" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="J" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="K|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="K" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="L|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="L" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="M|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="M" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="N|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="N" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="O|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="O" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="P|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="P" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Q|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Q" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="R|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="R" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="S|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="S" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="T|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="T" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="U|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="U" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="V|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="V" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="W|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="W" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="X|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="X" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Y|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Y" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Z|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Z" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Account Name</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}" onkeypress="return runOnEnter(event);" />
<apex:commandButton value="Search" action="{!doSearch}" id="searchBtn" status="searchStaus" rerender="block" />
<apex:actionstatus id="searchStaus">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">searching...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Results" id="results" columns="1" rendered="{!IF(accounts.size != null && accounts.size > 0, true , false)}">
<apex:pageBlockTable value="{!lstacc}" var="l">
<apex:column >
<apex:facet name="header">
<apex:selectRadio onclick="checkAll(this)">
</apex:selectRadio>
</apex:facet>
<apex:selectRadio id="Radiodone">
</apex:selectRadio>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this)">
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox id="checkedone">
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="Action" >
<apex:outputLink title="" value="/{!l.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
<a href="javascript:if (window.confirm('Are you sure?')) doDelete('{!l.Id}');" style="font-weight:bold">Del</a>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Account Name{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="name" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="Phone" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Phone}</apex:outputLink>
</apex:column>
<apex:column value="{!l.BillingCity}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing City{!IF(sortExpression=='BillingCity',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCity" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
<apex:column value="{!l.BillingCountry}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing Country{!IF(sortExpression=='BillingCountry',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCountry" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" rerender="results" action="{!First}" disabled="{!!hasPrevious}" />
<apex:commandButton value="<" rerender="results" action="{!Previous}" disabled="{!!hasPrevious}" />
<apex:commandButton value=">" rerender="results" action="{!Next}" disabled="{!!hasNext}" />
<apex:commandButton value=">|" rerender="results" action="{!Last}" disabled="{!!hasNext}" />
<apex:outputText >{!(pageno * 5)+1-5}-{!IF((pageno * 5)>count , count,(pageno * 5))} of {!count}</apex:outputText>
<br/>
<apex:outputText >Page
<apex:inputText value="{!pageno}" size="1" /> Of {!totalPages }</apex:outputText>
<apex:actionFunction action="{!doDelete}" name="doDelete" reRender="form" status="DeleteStaus1" >
<apex:param name="accountId" value="" assignTo="{!accountId}"/>
</apex:actionFunction>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
-
- Adarsh Sharma 4
- December 19, 2015
- Like
- 0
page navigate with custom pagination
hi,all I'm create a simple inputtextfield for page number .in this inputfield I'm enter a page number to navigate
[this is my vf page.problem in red mark]
[this is my vf page.problem in red mark]
-
- Adarsh Sharma 4
- December 10, 2015
- Like
- 0
page navigation with custom pagination
hi,all I'm create a simple inputtextfield for page number .in this inputfield I'm enter a page number to navigate
-
- Adarsh Sharma 4
- December 10, 2015
- Like
- 0
custom pagination without offset
Hi ,all.I'm doing custom pagination and I'm receving the following error
System.ListException: List index out of bounds: 2
Error is in expression '{!doSearch}' in component <apex:commandButton> in page simplecustompagination: Class.simpleCustomPagination.doSearch: line 100, column 1
this is my code
public with sharing class simpleCustomPagination {
Public Boolean hasPrevious {
get;
set;
}
Public Boolean hasNext {
get;
set;
}
Public Integer pageno {
get;
set;
}
Public List < Account > lstacc {
get;
set;
}
Public Integer count {
get;
set;
}
String searchText;
public List < Account > accounts {
get;
set;
}
Public simpleCustomPagination(ApexPages.StandardSetController controller) {}
public simpleCustomPagination(ApexPages.StandardController controller) {}
private String sortDirection = 'ASC';
private String sortExp = 'name';
public String sortExpression {
get {
return sortExp;
}
set {
//if the column is clicked on then switch between Ascending and Descending modes
if (value == sortExp)
sortDirection = (sortDirection == 'ASC') ? 'DESC' : 'ASC';
else
sortDirection = 'ASC';
sortExp = value;
}
}
public String getSortDirection() {
//if not column is selected
if (sortExpression == null || sortExpression == '')
return 'ASC';
else
return sortDirection;
}
public void setSortDirection(String value) {
sortDirection = value;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public PageReference doSearch() {
String query = '';
String strFilter = '';
string sortFullExp = sortExpression + ' ' + sortDirection;
if (searchText != null) {
strFilter = strFilter + ' where Name Like \'' + searchText + '%\'';
}
if (strFilter != '') {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account ' + strFilter + 'order by ' + sortFullExp;
} else {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account order by ' + sortFullExp;
}
accounts = Database.query(query);
lstacc = new List < Account > ();
if (accounts.size() > 0) {
count = accounts.size();
hasPrevious = false;
hasNext = true;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
return null;
}
Public void First() {
hasNext = true;
lstacc.clear();
hasPrevious = false;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
Public void Previous() {
hasNext = true;
lstacc.clear();
if (pageno != 1) {
pageno = pageno - 1;
If(pageno == 1)
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else {
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
}
}
Public void Next() {
pageno = pageno + 1;
integer pgno;
lstacc.clear();
if (math.mod(accounts.size(), 5) == 0) {
pgno = accounts.size() / 5;
} else
pgno = (accounts.size() / 5) + 1;
if (pageno == pgno) {
hasNext = false;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
hasPrevious = true;
System.debug('---------------------------- LIST SIZE OF TEMPLIST ---------------------' + accounts.size());
}
Public void Last() {
System.debug('---------------------------------------------- LAST METHOD IS CALLING ----------------------');
hasPrevious = true;
lstacc.clear();
hasNext = false;
if (math.mod(accounts.size(), 5) == 0)
pageno = accounts.size() / 5;
else
pageno = (accounts.size() / 5) + 1;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
}
}
}
System.ListException: List index out of bounds: 2
Error is in expression '{!doSearch}' in component <apex:commandButton> in page simplecustompagination: Class.simpleCustomPagination.doSearch: line 100, column 1
this is my code
public with sharing class simpleCustomPagination {
Public Boolean hasPrevious {
get;
set;
}
Public Boolean hasNext {
get;
set;
}
Public Integer pageno {
get;
set;
}
Public List < Account > lstacc {
get;
set;
}
Public Integer count {
get;
set;
}
String searchText;
public List < Account > accounts {
get;
set;
}
Public simpleCustomPagination(ApexPages.StandardSetController controller) {}
public simpleCustomPagination(ApexPages.StandardController controller) {}
private String sortDirection = 'ASC';
private String sortExp = 'name';
public String sortExpression {
get {
return sortExp;
}
set {
//if the column is clicked on then switch between Ascending and Descending modes
if (value == sortExp)
sortDirection = (sortDirection == 'ASC') ? 'DESC' : 'ASC';
else
sortDirection = 'ASC';
sortExp = value;
}
}
public String getSortDirection() {
//if not column is selected
if (sortExpression == null || sortExpression == '')
return 'ASC';
else
return sortDirection;
}
public void setSortDirection(String value) {
sortDirection = value;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public PageReference doSearch() {
String query = '';
String strFilter = '';
string sortFullExp = sortExpression + ' ' + sortDirection;
if (searchText != null) {
strFilter = strFilter + ' where Name Like \'' + searchText + '%\'';
}
if (strFilter != '') {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account ' + strFilter + 'order by ' + sortFullExp;
} else {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account order by ' + sortFullExp;
}
accounts = Database.query(query);
lstacc = new List < Account > ();
if (accounts.size() > 0) {
count = accounts.size();
hasPrevious = false;
hasNext = true;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
return null;
}
Public void First() {
hasNext = true;
lstacc.clear();
hasPrevious = false;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
Public void Previous() {
hasNext = true;
lstacc.clear();
if (pageno != 1) {
pageno = pageno - 1;
If(pageno == 1)
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else {
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
}
}
Public void Next() {
pageno = pageno + 1;
integer pgno;
lstacc.clear();
if (math.mod(accounts.size(), 5) == 0) {
pgno = accounts.size() / 5;
} else
pgno = (accounts.size() / 5) + 1;
if (pageno == pgno) {
hasNext = false;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
hasPrevious = true;
System.debug('---------------------------- LIST SIZE OF TEMPLIST ---------------------' + accounts.size());
}
Public void Last() {
System.debug('---------------------------------------------- LAST METHOD IS CALLING ----------------------');
hasPrevious = true;
lstacc.clear();
hasNext = false;
if (math.mod(accounts.size(), 5) == 0)
pageno = accounts.size() / 5;
else
pageno = (accounts.size() / 5) + 1;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
}
}
}
-
- Adarsh Sharma 4
- December 03, 2015
- Like
- 0
unable to solve this error
etting error : - Constructor not defined: need help
public class My_2nd_Api {
Public static void Insert_Records(){
List<Opportunity> oppbatch=[select id,name,stageName,Edition__r.name,Sub_Allocation_Name__r.name,Account.name,Account.Website,Account.BillingCountry,Account.BillingState,Account.BillingCity,Account.BillingStreet,Account.BillingPostalcode,(select Unique_id__c,Product_Sub_Category_New__c,stand_Number_s__c,Hall_s__c,Type_of_Stand__c,Stand_Depth__c,Stand_Width__c,
Contractual_Sq_M__c, Exhibitor_Id__c,Open_Sides__c from OpportunityLineItems), (Select contact.firstname,contact.lastname,contact.Email,contact.Phone,contact.Salutation from OpportunityContactRoles)
from Opportunity limit 10];
system.debug('oppbatch List query.. '+oppbatch);
List<OppWrapper> oppWrapperVarList = new List<OppWrapper>();
for(Opportunity opp : oppbatch)
{
system.debug('Chehking'+opp.OpportunityLineItems);
OppWrapper oppwrappervar= new OppWrapper(opp.id,opp.name,opp.StageName,opp.Edition__r.name,opp.Sub_Allocation_Name__r.name,opp.Account.name,opp.Account.Website, opp.Account.BillingCountry,opp.Account.BillingState,opp.Account.BillingCity,opp.Account.BillingStreet, opp.Account.BillingPostalcode);
for(OpportunityLineItem li : opp.OpportunityLineItems)
{
oppwrappervar(li.Unique_id__c,li.Product_Sub_Category_New__c,li.Stand_Number_s__c,li.Hall_s__c,li.Type_of_Stand__c,li.Stand_Depth__c,li.Stand_Width__c,li.Contractual_Sq_M__c);
}
for(OpportunityContactRole ocr : opp.OpportunityContactRoles)
{
oppwrappervar(ocr.contact.firstname,ocr.contact.lastname,ocr.contact.Email,ocr.contact.Phone,ocr.contact.Salutation);
}
oppWrapperVarList.add(oppwrappervar);
//OppWrapper oppwrappervar=new OppWrapper(oppbtch.Edition_Name__c,oppbtch.Opportunity_Id__c,oppbtch.Opportunity_Name__c,oppbtch.Opportunity_Stage__c,oppbtch.Stand_No__c,oppbtch.Banner_name__c);
//oppWrapperVarList.add(oppwrappervar);
}
string jsonbody=Json.serialize(oppWrapperVarList);
system.debug('Json body---->'+jsonbody);
Http http = new Http();
HttpRequest request = new HttpRequest();
//request.setEndpoint('http://fpdatamap.salesforceoutsourcing.in/api/FPDatas');
request.setEndpoint('http://sfdata.iqratechnology.com/api/sf_data');
request.setMethod('POST');
request.setHeader('Content-Type','application/json');
//request.setHeader('Content-Type','multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
//request.setHeader('Authorization','Bearer '+ AuthorizationToken);
//request.setBody('[{ "RecordId": "456","RecordName": "moosa traders pvt ltd / The Big 5 Construct Egypt 2018 / / 093061123", "EventName": "a2JD0000001ns6uMAA U", "RecordStage": "Test Stage Amjad","BannerName": "Test Banner Amjad","StandNo": "Test Stand Amjad"}]');
request.setBody(jsonbody);
HttpResponse response = http.send(request);
system.debug('Response body '+ response.getBody());
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
public class OppWrapper
{
public String SFDC_RecordID {get;set;}
public String SFDC_RecordName {get;set;}
public String SFDC_RecordStage {get;set;}
public String SFDC_EventName {get;set;}
public String Stan_Sub_Allocation_Name {get;set;}
public String Acount_Long_Name {get;set;}
public String Web_Site {get;set;}
public String Country {get;set;}
public String Country_State {get;set;}
public String City {get;set;}
public String Street {get;set;}
public String Post_code {get;set;}
public String SFDC_Record_Unique_ID {get;set;}
public String Product_Subcategory {get;set;}
public String Stand_no {get;set;}
public String Hall {get;set;}
public String Type_of_Stand {get;set;}
public Decimal Height {get;set;}
public Decimal Width {get;set;}
public Decimal Contractual_Sq_M {get;set;}
public String First_Name {get;set;}
public String Last_Name {get;set;}
public String Email {get;set;}
public String Mobile {get;set;}
public String Salutation {get;set;}
public OppWrapper(String SFDC_RecordID,String SFDC_RecordName,String SFDC_RecordStage,String SFDC_EventName,String Stan_Sub_Allocation_Name,
String Acount_Long_Name,String Web_Site,String Country,String Country_State,String City,String Street,String Post_code,
String SFDC_Record_Unique_ID,String Product_Subcategory,String Stand_no,String Hall,String Type_of_Stand,Decimal Height,
Decimal Width,Decimal Contractual_Sq_M,String First_Name,String Last_Name,String Email,String Mobile,String Salutation)
{
this.SFDC_RecordID =SFDC_RecordID;
this.SFDC_RecordName =SFDC_RecordName;
this.SFDC_RecordStage =SFDC_RecordStage;
this.SFDC_EventName=SFDC_EventName;
this.Stan_Sub_Allocation_Name=Stan_Sub_Allocation_Name;
this.Acount_Long_Name=Acount_Long_Name;
this.Web_Site=Web_Site;
this.Country=Country;
this.Country_State=Country_State;
this.City=City;
this.Street=Street;
this.Post_code=Post_code;
this.SFDC_Record_Unique_ID=SFDC_Record_Unique_ID;
this.Product_Subcategory=Product_Subcategory;
this.Stand_no=Stand_no;
this.Hall=Hall;
this.Type_of_Stand=Type_of_Stand;
this.Height=Height;
this.Width=Width;
this.Contractual_Sq_M=Contractual_Sq_M;
}
}
}
Getting error on bold line error is :-
Line 17: Constructor not defined: [My_2nd_Api.OppWrapper].<Constructor>(String, String, String, String, String, String, String, String, String, String, String)
Line 24 Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, Id, Decimal, Decimal, Decimal) from the type My_2nd_Api
Line 29 : Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, String) from the type My_2nd_Api
Can anyone please help me to solve this error it is urgent
public class My_2nd_Api {
Public static void Insert_Records(){
List<Opportunity> oppbatch=[select id,name,stageName,Edition__r.name,Sub_Allocation_Name__r.name,Account.name,Account.Website,Account.BillingCountry,Account.BillingState,Account.BillingCity,Account.BillingStreet,Account.BillingPostalcode,(select Unique_id__c,Product_Sub_Category_New__c,stand_Number_s__c,Hall_s__c,Type_of_Stand__c,Stand_Depth__c,Stand_Width__c,
Contractual_Sq_M__c, Exhibitor_Id__c,Open_Sides__c from OpportunityLineItems), (Select contact.firstname,contact.lastname,contact.Email,contact.Phone,contact.Salutation from OpportunityContactRoles)
from Opportunity limit 10];
system.debug('oppbatch List query.. '+oppbatch);
List<OppWrapper> oppWrapperVarList = new List<OppWrapper>();
for(Opportunity opp : oppbatch)
{
system.debug('Chehking'+opp.OpportunityLineItems);
OppWrapper oppwrappervar= new OppWrapper(opp.id,opp.name,opp.StageName,opp.Edition__r.name,opp.Sub_Allocation_Name__r.name,opp.Account.name,opp.Account.Website, opp.Account.BillingCountry,opp.Account.BillingState,opp.Account.BillingCity,opp.Account.BillingStreet, opp.Account.BillingPostalcode);
for(OpportunityLineItem li : opp.OpportunityLineItems)
{
oppwrappervar(li.Unique_id__c,li.Product_Sub_Category_New__c,li.Stand_Number_s__c,li.Hall_s__c,li.Type_of_Stand__c,li.Stand_Depth__c,li.Stand_Width__c,li.Contractual_Sq_M__c);
}
for(OpportunityContactRole ocr : opp.OpportunityContactRoles)
{
oppwrappervar(ocr.contact.firstname,ocr.contact.lastname,ocr.contact.Email,ocr.contact.Phone,ocr.contact.Salutation);
}
oppWrapperVarList.add(oppwrappervar);
//OppWrapper oppwrappervar=new OppWrapper(oppbtch.Edition_Name__c,oppbtch.Opportunity_Id__c,oppbtch.Opportunity_Name__c,oppbtch.Opportunity_Stage__c,oppbtch.Stand_No__c,oppbtch.Banner_name__c);
//oppWrapperVarList.add(oppwrappervar);
}
string jsonbody=Json.serialize(oppWrapperVarList);
system.debug('Json body---->'+jsonbody);
Http http = new Http();
HttpRequest request = new HttpRequest();
//request.setEndpoint('http://fpdatamap.salesforceoutsourcing.in/api/FPDatas');
request.setEndpoint('http://sfdata.iqratechnology.com/api/sf_data');
request.setMethod('POST');
request.setHeader('Content-Type','application/json');
//request.setHeader('Content-Type','multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
//request.setHeader('Authorization','Bearer '+ AuthorizationToken);
//request.setBody('[{ "RecordId": "456","RecordName": "moosa traders pvt ltd / The Big 5 Construct Egypt 2018 / / 093061123", "EventName": "a2JD0000001ns6uMAA U", "RecordStage": "Test Stage Amjad","BannerName": "Test Banner Amjad","StandNo": "Test Stand Amjad"}]');
request.setBody(jsonbody);
HttpResponse response = http.send(request);
system.debug('Response body '+ response.getBody());
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
}
public class OppWrapper
{
public String SFDC_RecordID {get;set;}
public String SFDC_RecordName {get;set;}
public String SFDC_RecordStage {get;set;}
public String SFDC_EventName {get;set;}
public String Stan_Sub_Allocation_Name {get;set;}
public String Acount_Long_Name {get;set;}
public String Web_Site {get;set;}
public String Country {get;set;}
public String Country_State {get;set;}
public String City {get;set;}
public String Street {get;set;}
public String Post_code {get;set;}
public String SFDC_Record_Unique_ID {get;set;}
public String Product_Subcategory {get;set;}
public String Stand_no {get;set;}
public String Hall {get;set;}
public String Type_of_Stand {get;set;}
public Decimal Height {get;set;}
public Decimal Width {get;set;}
public Decimal Contractual_Sq_M {get;set;}
public String First_Name {get;set;}
public String Last_Name {get;set;}
public String Email {get;set;}
public String Mobile {get;set;}
public String Salutation {get;set;}
public OppWrapper(String SFDC_RecordID,String SFDC_RecordName,String SFDC_RecordStage,String SFDC_EventName,String Stan_Sub_Allocation_Name,
String Acount_Long_Name,String Web_Site,String Country,String Country_State,String City,String Street,String Post_code,
String SFDC_Record_Unique_ID,String Product_Subcategory,String Stand_no,String Hall,String Type_of_Stand,Decimal Height,
Decimal Width,Decimal Contractual_Sq_M,String First_Name,String Last_Name,String Email,String Mobile,String Salutation)
{
this.SFDC_RecordID =SFDC_RecordID;
this.SFDC_RecordName =SFDC_RecordName;
this.SFDC_RecordStage =SFDC_RecordStage;
this.SFDC_EventName=SFDC_EventName;
this.Stan_Sub_Allocation_Name=Stan_Sub_Allocation_Name;
this.Acount_Long_Name=Acount_Long_Name;
this.Web_Site=Web_Site;
this.Country=Country;
this.Country_State=Country_State;
this.City=City;
this.Street=Street;
this.Post_code=Post_code;
this.SFDC_Record_Unique_ID=SFDC_Record_Unique_ID;
this.Product_Subcategory=Product_Subcategory;
this.Stand_no=Stand_no;
this.Hall=Hall;
this.Type_of_Stand=Type_of_Stand;
this.Height=Height;
this.Width=Width;
this.Contractual_Sq_M=Contractual_Sq_M;
}
}
}
Getting error on bold line error is :-
Line 17: Constructor not defined: [My_2nd_Api.OppWrapper].<Constructor>(String, String, String, String, String, String, String, String, String, String, String)
Line 24 Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, Id, Decimal, Decimal, Decimal) from the type My_2nd_Api
Line 29 : Method does not exist or incorrect signature: void oppwrappervar(String, String, String, String, String) from the type My_2nd_Api
Can anyone please help me to solve this error it is urgent
- Iqra Tech
- May 29, 2019
- Like
- 0
need to delete custom object records
Hello all,
i have a custom object called Interests__c
we have discontinued using this object and it has 240,000 records in it.
we need to get rid of these.
on top of that we have master detail and look ups which is not allowing to truncate

can you guys help me with this ?
Kind Regards,
Jaya
i have a custom object called Interests__c
we have discontinued using this object and it has 240,000 records in it.
we need to get rid of these.
on top of that we have master detail and look ups which is not allowing to truncate
can you guys help me with this ?
Kind Regards,
Jaya
- Jaya Sankar Bagepalli
- September 13, 2016
- Like
- 0
selectRadio and checkbox with custom Pagination?
Hi,all I'm create simple custom pagination vf page .now I'm facing a problem ,when i'm check radio button all check box are selected
please help for this
vf page::::
<apex:page Controller="simpleCustomPagination11">
<div style="padding-top:20px;">
<apex:actionstatus id="DeleteStaus1">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">Delete...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</div>
<script type='text/javascript'>
function runOnEnter(ev) {
if (window.event && window.event.keyCode == 13 || ev.which == 13) {
searchAccRecs();
return false;
} else {
return true;
}
}
function checkAll(cb) {
var inputElem = document.getElementsByTagName("input");
for (var i = 0; i < inputElem.length; i++) {
if (inputElem[i].id.indexOf("checkedone") != -1)
inputElem[i].checked = cb.checked;
}
}
</script>
<apex:form id="form" >
<apex:actionFunction name="searchAccRecs" action="{!doSearch}" reRender="block" />
<apex:pageBlock title="Search" mode="edit" id="block">
<apex:pagemessages />
<span>
<apex:commandlink value="A|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="A" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="B |" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="B" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="C|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="C" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="D|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="D" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="E|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="E" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="F|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="F" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="G|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="G" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="H|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="H" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="I|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="I" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="J |" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="J" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="K|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="K" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="L|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="L" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="M|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="M" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="N|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="N" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="O|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="O" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="P|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="P" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Q|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Q" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="R|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="R" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="S|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="S" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="T|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="T" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="U|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="U" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="V|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="V" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="W|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="W" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="X|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="X" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Y|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Y" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Z|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Z" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Account Name</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}" onkeypress="return runOnEnter(event);" />
<apex:commandButton value="Search" action="{!doSearch}" id="searchBtn" status="searchStaus" rerender="block" />
<apex:actionstatus id="searchStaus">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">searching...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Results" id="results" columns="1" rendered="{!IF(accounts.size != null && accounts.size > 0, true , false)}">
<apex:pageBlockTable value="{!lstacc}" var="l">
<apex:column >
<apex:facet name="header">
<apex:selectRadio onclick="checkAll(this)">
</apex:selectRadio>
</apex:facet>
<apex:selectRadio id="Radiodone">
</apex:selectRadio>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this)">
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox id="checkedone">
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="Action" >
<apex:outputLink title="" value="/{!l.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
<a href="javascript:if (window.confirm('Are you sure?')) doDelete('{!l.Id}');" style="font-weight:bold">Del</a>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Account Name{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="name" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="Phone" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Phone}</apex:outputLink>
</apex:column>
<apex:column value="{!l.BillingCity}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing City{!IF(sortExpression=='BillingCity',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCity" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
<apex:column value="{!l.BillingCountry}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing Country{!IF(sortExpression=='BillingCountry',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCountry" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" rerender="results" action="{!First}" disabled="{!!hasPrevious}" />
<apex:commandButton value="<" rerender="results" action="{!Previous}" disabled="{!!hasPrevious}" />
<apex:commandButton value=">" rerender="results" action="{!Next}" disabled="{!!hasNext}" />
<apex:commandButton value=">|" rerender="results" action="{!Last}" disabled="{!!hasNext}" />
<apex:outputText >{!(pageno * 5)+1-5}-{!IF((pageno * 5)>count , count,(pageno * 5))} of {!count}</apex:outputText>
<br/>
<apex:outputText >Page
<apex:inputText value="{!pageno}" size="1" /> Of {!totalPages }</apex:outputText>
<apex:actionFunction action="{!doDelete}" name="doDelete" reRender="form" status="DeleteStaus1" >
<apex:param name="accountId" value="" assignTo="{!accountId}"/>
</apex:actionFunction>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
please help for this
vf page::::
<apex:page Controller="simpleCustomPagination11">
<div style="padding-top:20px;">
<apex:actionstatus id="DeleteStaus1">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">Delete...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</div>
<script type='text/javascript'>
function runOnEnter(ev) {
if (window.event && window.event.keyCode == 13 || ev.which == 13) {
searchAccRecs();
return false;
} else {
return true;
}
}
function checkAll(cb) {
var inputElem = document.getElementsByTagName("input");
for (var i = 0; i < inputElem.length; i++) {
if (inputElem[i].id.indexOf("checkedone") != -1)
inputElem[i].checked = cb.checked;
}
}
</script>
<apex:form id="form" >
<apex:actionFunction name="searchAccRecs" action="{!doSearch}" reRender="block" />
<apex:pageBlock title="Search" mode="edit" id="block">
<apex:pagemessages />
<span>
<apex:commandlink value="A|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="A" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="B |" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="B" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="C|" action="{!namesearch}" reRender="block" >
<apex:param name="search" value="C" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="D|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="D" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="E|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="E" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="F|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="F" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="G|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="G" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="H|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="H" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="I|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="I" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="J |" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="J" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="K|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="K" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="L|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="L" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="M|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="M" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="N|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="N" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="O|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="O" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="P|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="P" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Q|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Q" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="R|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="R" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="S|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="S" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="T|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="T" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="U|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="U" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="V|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="V" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="W|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="W" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="X|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="X" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Y|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Y" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<span>
<apex:commandlink value="Z|" action="{!namesearch}" reRender="block" >
<apex:param name="searchname" value="Z" assignTo="{!searchname}"/>
</apex:commandlink>
</span>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Account Name</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}" onkeypress="return runOnEnter(event);" />
<apex:commandButton value="Search" action="{!doSearch}" id="searchBtn" status="searchStaus" rerender="block" />
<apex:actionstatus id="searchStaus">
<apex:facet name="start">
<span style="color:red;font-weight:bold;padding-left:5px;">searching...</span>
<img src="/img/loading.gif" alt="" />
</apex:facet>
</apex:actionstatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Results" id="results" columns="1" rendered="{!IF(accounts.size != null && accounts.size > 0, true , false)}">
<apex:pageBlockTable value="{!lstacc}" var="l">
<apex:column >
<apex:facet name="header">
<apex:selectRadio onclick="checkAll(this)">
</apex:selectRadio>
</apex:facet>
<apex:selectRadio id="Radiodone">
</apex:selectRadio>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox onclick="checkAll(this)">
</apex:inputCheckbox>
</apex:facet>
<apex:inputCheckbox id="checkedone">
</apex:inputCheckbox>
</apex:column>
<apex:column headerValue="Action" >
<apex:outputLink title="" value="/{!l.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
<a href="javascript:if (window.confirm('Are you sure?')) doDelete('{!l.Id}');" style="font-weight:bold">Del</a>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Account Name{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="name" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="Phone" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
<apex:outputLink target="_blank">{!l.Phone}</apex:outputLink>
</apex:column>
<apex:column value="{!l.BillingCity}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing City{!IF(sortExpression=='BillingCity',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCity" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
<apex:column value="{!l.BillingCountry}">
<apex:facet name="header">
<apex:commandLink action="{!doSearch}" value="Billing Country{!IF(sortExpression=='BillingCountry',IF(sortDirection='ASC','▼','▲'),'')}">
<apex:param value="BillingCountry" name="column" assignTo="{!sortExpression}"></apex:param>
</apex:commandLink>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" rerender="results" action="{!First}" disabled="{!!hasPrevious}" />
<apex:commandButton value="<" rerender="results" action="{!Previous}" disabled="{!!hasPrevious}" />
<apex:commandButton value=">" rerender="results" action="{!Next}" disabled="{!!hasNext}" />
<apex:commandButton value=">|" rerender="results" action="{!Last}" disabled="{!!hasNext}" />
<apex:outputText >{!(pageno * 5)+1-5}-{!IF((pageno * 5)>count , count,(pageno * 5))} of {!count}</apex:outputText>
<br/>
<apex:outputText >Page
<apex:inputText value="{!pageno}" size="1" /> Of {!totalPages }</apex:outputText>
<apex:actionFunction action="{!doDelete}" name="doDelete" reRender="form" status="DeleteStaus1" >
<apex:param name="accountId" value="" assignTo="{!accountId}"/>
</apex:actionFunction>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
- Adarsh Sharma 4
- December 19, 2015
- Like
- 0
custom pagination without offset
Hi ,all.I'm doing custom pagination and I'm receving the following error
System.ListException: List index out of bounds: 2
Error is in expression '{!doSearch}' in component <apex:commandButton> in page simplecustompagination: Class.simpleCustomPagination.doSearch: line 100, column 1
this is my code
public with sharing class simpleCustomPagination {
Public Boolean hasPrevious {
get;
set;
}
Public Boolean hasNext {
get;
set;
}
Public Integer pageno {
get;
set;
}
Public List < Account > lstacc {
get;
set;
}
Public Integer count {
get;
set;
}
String searchText;
public List < Account > accounts {
get;
set;
}
Public simpleCustomPagination(ApexPages.StandardSetController controller) {}
public simpleCustomPagination(ApexPages.StandardController controller) {}
private String sortDirection = 'ASC';
private String sortExp = 'name';
public String sortExpression {
get {
return sortExp;
}
set {
//if the column is clicked on then switch between Ascending and Descending modes
if (value == sortExp)
sortDirection = (sortDirection == 'ASC') ? 'DESC' : 'ASC';
else
sortDirection = 'ASC';
sortExp = value;
}
}
public String getSortDirection() {
//if not column is selected
if (sortExpression == null || sortExpression == '')
return 'ASC';
else
return sortDirection;
}
public void setSortDirection(String value) {
sortDirection = value;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public PageReference doSearch() {
String query = '';
String strFilter = '';
string sortFullExp = sortExpression + ' ' + sortDirection;
if (searchText != null) {
strFilter = strFilter + ' where Name Like \'' + searchText + '%\'';
}
if (strFilter != '') {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account ' + strFilter + 'order by ' + sortFullExp;
} else {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account order by ' + sortFullExp;
}
accounts = Database.query(query);
lstacc = new List < Account > ();
if (accounts.size() > 0) {
count = accounts.size();
hasPrevious = false;
hasNext = true;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
return null;
}
Public void First() {
hasNext = true;
lstacc.clear();
hasPrevious = false;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
Public void Previous() {
hasNext = true;
lstacc.clear();
if (pageno != 1) {
pageno = pageno - 1;
If(pageno == 1)
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else {
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
}
}
Public void Next() {
pageno = pageno + 1;
integer pgno;
lstacc.clear();
if (math.mod(accounts.size(), 5) == 0) {
pgno = accounts.size() / 5;
} else
pgno = (accounts.size() / 5) + 1;
if (pageno == pgno) {
hasNext = false;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
hasPrevious = true;
System.debug('---------------------------- LIST SIZE OF TEMPLIST ---------------------' + accounts.size());
}
Public void Last() {
System.debug('---------------------------------------------- LAST METHOD IS CALLING ----------------------');
hasPrevious = true;
lstacc.clear();
hasNext = false;
if (math.mod(accounts.size(), 5) == 0)
pageno = accounts.size() / 5;
else
pageno = (accounts.size() / 5) + 1;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
}
}
}
System.ListException: List index out of bounds: 2
Error is in expression '{!doSearch}' in component <apex:commandButton> in page simplecustompagination: Class.simpleCustomPagination.doSearch: line 100, column 1
this is my code
public with sharing class simpleCustomPagination {
Public Boolean hasPrevious {
get;
set;
}
Public Boolean hasNext {
get;
set;
}
Public Integer pageno {
get;
set;
}
Public List < Account > lstacc {
get;
set;
}
Public Integer count {
get;
set;
}
String searchText;
public List < Account > accounts {
get;
set;
}
Public simpleCustomPagination(ApexPages.StandardSetController controller) {}
public simpleCustomPagination(ApexPages.StandardController controller) {}
private String sortDirection = 'ASC';
private String sortExp = 'name';
public String sortExpression {
get {
return sortExp;
}
set {
//if the column is clicked on then switch between Ascending and Descending modes
if (value == sortExp)
sortDirection = (sortDirection == 'ASC') ? 'DESC' : 'ASC';
else
sortDirection = 'ASC';
sortExp = value;
}
}
public String getSortDirection() {
//if not column is selected
if (sortExpression == null || sortExpression == '')
return 'ASC';
else
return sortDirection;
}
public void setSortDirection(String value) {
sortDirection = value;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public PageReference doSearch() {
String query = '';
String strFilter = '';
string sortFullExp = sortExpression + ' ' + sortDirection;
if (searchText != null) {
strFilter = strFilter + ' where Name Like \'' + searchText + '%\'';
}
if (strFilter != '') {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account ' + strFilter + 'order by ' + sortFullExp;
} else {
query = 'Select id, Name, BillingCity, BillingCountry, Phone from Account order by ' + sortFullExp;
}
accounts = Database.query(query);
lstacc = new List < Account > ();
if (accounts.size() > 0) {
count = accounts.size();
hasPrevious = false;
hasNext = true;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
return null;
}
Public void First() {
hasNext = true;
lstacc.clear();
hasPrevious = false;
pageno = 1;
for (integer i = 0; i < 5; i++) {
lstacc.add(accounts[i]);
}
}
Public void Previous() {
hasNext = true;
lstacc.clear();
if (pageno != 1) {
pageno = pageno - 1;
If(pageno == 1)
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else {
hasPrevious = false;
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
}
}
Public void Next() {
pageno = pageno + 1;
integer pgno;
lstacc.clear();
if (math.mod(accounts.size(), 5) == 0) {
pgno = accounts.size() / 5;
} else
pgno = (accounts.size() / 5) + 1;
if (pageno == pgno) {
hasNext = false;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
} else
for (integer i = (pageno - 1) * 5; i < (pageno * 5); i++) {
lstacc.add(accounts[i]);
System.debug('--------------------SIZE OF PAGINATION LIST---------------------' + lstacc.size() + ' RECORDS ' + accounts[i]);
}
hasPrevious = true;
System.debug('---------------------------- LIST SIZE OF TEMPLIST ---------------------' + accounts.size());
}
Public void Last() {
System.debug('---------------------------------------------- LAST METHOD IS CALLING ----------------------');
hasPrevious = true;
lstacc.clear();
hasNext = false;
if (math.mod(accounts.size(), 5) == 0)
pageno = accounts.size() / 5;
else
pageno = (accounts.size() / 5) + 1;
for (integer i = (pageno - 1) * 5; i < accounts.size(); i++) {
lstacc.add(accounts[i]);
}
}
}
- Adarsh Sharma 4
- December 03, 2015
- Like
- 0