• rahul reddy 21
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi,
I have a picklist field on account object,using search button I am able to filter the records by selecting a picklist value.
but now i want to use the same picklist value as multi-select  picklist. 
can any one help me in resolving the issue.

Vf code:
<apex:page controller="ACCsearch">
  <apex:form id="form">  
        <span>Name</span>
        <apex:inputText value="{!searchstring}" label="Input"/>        
        <apex:selectList value="{!Typeoptions}" label="Type" size="2" multiselect="true" >
            <span>Type</span>
            <apex:selectOptions value="{!selectedType}"></apex:selectOptions>
        </apex:selectList>
            <apex:commandButton value="Searchrecords" action="{!search1}"/>
                <apex:pageBlock title="Inst Records" id="Block1">
                <apex:pageBlockSection id="section" collapsible="true" title="TABS">                
                    <apex:pageBlockTable value="{!Instlist}" var="inst" >
                        <apex:column value="{!inst.Name}"/>                                            
                        <apex:column value="{!inst.Type}"/>        
                    </apex:pageBlockTable>                    
                </apex:pageBlockSection>    
        </apex:pageBlock>           
    </apex:form>
</apex:page> 

apex code:
public class ACCsearch
{
    public list<Account> Instlist{get;set;}
    public string searchstring{get;set;}
    public string Typeoptions{get;set;}
    public ACCsearch()
    {
        string strqry ='select Name,Type  from Account';
        Instlist=Database.query(strqry); 
    }
    public list<Selectoption> GetselectedType()
    {
       List<SelectOption> options = new List<SelectOption>();           
       Schema.DescribeFieldResult fieldResult =Account.Type.getDescribe();
       List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();           
       options.add(new SelectOption('None','--None--'));
       for( Schema.PicklistEntry f : ple)
       {
          options.add(new SelectOption(f.getLabel(), f.getValue()));
       }       
           return options;
    } 
     public void search1()
    {  
        string strqry ='select id,Name, Active__c,Type from Account where id !=null ';
        if(Typeoptions!='None')
        {
           strqry =strqry +'and Type LIKE \'%'+Typeoptions+'%\'';
        }
        if(searchstring!='')
        {
           strqry =strqry +'and Name LIKE \'%'+searchstring+'%\'';
        }
        Instlist=Database.query(strqry);  
   }         
}
Hi,
I am trying to display the record details upon clicking ExpandAll button.
I am able to show the number of records present...but unable to show its details upon clicking the ExpandAll button.

my present output :

 User-added image
My Expected output:

 User-added image
Hi,
I have a picklist field on account object,using search button I am able to filter the records by selecting a picklist value.
but now i want to use the same picklist value as multi-select  picklist. 
can any one help me in resolving the issue.

Vf code:
<apex:page controller="ACCsearch">
  <apex:form id="form">  
        <span>Name</span>
        <apex:inputText value="{!searchstring}" label="Input"/>        
        <apex:selectList value="{!Typeoptions}" label="Type" size="2" multiselect="true" >
            <span>Type</span>
            <apex:selectOptions value="{!selectedType}"></apex:selectOptions>
        </apex:selectList>
            <apex:commandButton value="Searchrecords" action="{!search1}"/>
                <apex:pageBlock title="Inst Records" id="Block1">
                <apex:pageBlockSection id="section" collapsible="true" title="TABS">                
                    <apex:pageBlockTable value="{!Instlist}" var="inst" >
                        <apex:column value="{!inst.Name}"/>                                            
                        <apex:column value="{!inst.Type}"/>        
                    </apex:pageBlockTable>                    
                </apex:pageBlockSection>    
        </apex:pageBlock>           
    </apex:form>
</apex:page> 

apex code:
public class ACCsearch
{
    public list<Account> Instlist{get;set;}
    public string searchstring{get;set;}
    public string Typeoptions{get;set;}
    public ACCsearch()
    {
        string strqry ='select Name,Type  from Account';
        Instlist=Database.query(strqry); 
    }
    public list<Selectoption> GetselectedType()
    {
       List<SelectOption> options = new List<SelectOption>();           
       Schema.DescribeFieldResult fieldResult =Account.Type.getDescribe();
       List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();           
       options.add(new SelectOption('None','--None--'));
       for( Schema.PicklistEntry f : ple)
       {
          options.add(new SelectOption(f.getLabel(), f.getValue()));
       }       
           return options;
    } 
     public void search1()
    {  
        string strqry ='select id,Name, Active__c,Type from Account where id !=null ';
        if(Typeoptions!='None')
        {
           strqry =strqry +'and Type LIKE \'%'+Typeoptions+'%\'';
        }
        if(searchstring!='')
        {
           strqry =strqry +'and Name LIKE \'%'+searchstring+'%\'';
        }
        Instlist=Database.query(strqry);  
   }         
}
Hi,
I am trying to display the record details upon clicking ExpandAll button.
I am able to show the number of records present...but unable to show its details upon clicking the ExpandAll button.

my present output :

 User-added image
My Expected output:

 User-added image