You need to sign in to do that
Don't have an account?
Salesforce Geevan
i was trying to query the Description(textarea) field of case object, when i click the find button entire record are displayed...help me
Vf page
<apex:page Controller="TEstConteroller" sidebar="false" standardStylesheets="true" showheader="false" >
<apex:form >
<apex:pageBlock title="CASE" >
<apex:pageBlockSection >
<label>Subject</label>
<apex:inputtext value="{!Sub}" />
<label>Description</label>
<apex:inputtext value="{!Des}" />
<center> <apex:commandButton value="find" action="{!search}" /></center>
</apex:pageBlockSection>
<apex:outputLabel >
<c:PageBlockTableEnhancerADV targetPbTableIds="tableRecords" paginate="true" defaultPageSize="50" pageSizeOptions="50,100,200"/>
</apex:outputLabel>
<apex:pageblockTable value="{!CaseList}" var="a" id="tableRecords" styleClass="list" border="1">
<apex:column headerValue="CaseNumber">
<apex:outputLink value="/{!a.id}">"{!a.CaseNumber}"</apex:outputLink>
</apex:column>
<apex:column headerValue="Priority"> {!a.Priority} </apex:column>
<apex:column headerValue="Origin"> {!a.Origin} </apex:column>
<apex:column headerValue="Owner"> {!a.owner.Name} </apex:column>
</apex:pageblockTable>
</apex:pageBlock>
Controller
public class TEstConteroller
{
public list<Case> caseList {get;set;}
public string Des {get;set;}
public string Sub{get;set;}
public void search()
{
CaseList = new List<Case>();
for(Case act : [select id,CaseNumber , Priority,Origin,Case.owner.Name,Description,Subject,from Case ]) {
if(act.Description.contains('Des') || act.Subject.contains('Sub')) {
caseList.add(act);
}
}
}
}
<apex:page Controller="TEstConteroller" sidebar="false" standardStylesheets="true" showheader="false" >
<apex:form >
<apex:pageBlock title="CASE" >
<apex:pageBlockSection >
<label>Subject</label>
<apex:inputtext value="{!Sub}" />
<label>Description</label>
<apex:inputtext value="{!Des}" />
<center> <apex:commandButton value="find" action="{!search}" /></center>
</apex:pageBlockSection>
<apex:outputLabel >
<c:PageBlockTableEnhancerADV targetPbTableIds="tableRecords" paginate="true" defaultPageSize="50" pageSizeOptions="50,100,200"/>
</apex:outputLabel>
<apex:pageblockTable value="{!CaseList}" var="a" id="tableRecords" styleClass="list" border="1">
<apex:column headerValue="CaseNumber">
<apex:outputLink value="/{!a.id}">"{!a.CaseNumber}"</apex:outputLink>
</apex:column>
<apex:column headerValue="Priority"> {!a.Priority} </apex:column>
<apex:column headerValue="Origin"> {!a.Origin} </apex:column>
<apex:column headerValue="Owner"> {!a.owner.Name} </apex:column>
</apex:pageblockTable>
</apex:pageBlock>
Controller
public class TEstConteroller
{
public list<Case> caseList {get;set;}
public string Des {get;set;}
public string Sub{get;set;}
public void search()
{
CaseList = new List<Case>();
for(Case act : [select id,CaseNumber , Priority,Origin,Case.owner.Name,Description,Subject,from Case ]) {
if(act.Description.contains('Des') || act.Subject.contains('Sub')) {
caseList.add(act);
}
}
}
}
Let me know in case of any more help .
why dont you use WHERE clause in SOQL, The query will fast as well use this: