function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
samrat.1985@lntinfotechsamrat.1985@lntinfotech

This is the current state of my post. in the above link.

I am getting the required result using SOSL,

which is searching in 3 objects and returning the result in a ordered list.

But instead of displaying it individually as you will find in the code. I want to get the result as merged list and then display in on the page according to my requirements.

Can any one help on this.

 

This is my VF Page....Which is currently displaying result from List Object A only.

 

<apex:page id="pg" controller="searchController" showheader="true" >
<head>
<base target="_parent" />

</head>
<apex:form id="frm"><apex:pageBlock >
<apex:pageBlockSection title="Seach Criteria" showHeader="true" columns="2">

<apex:inputText id="searchStr" value="{!srchText}"/>

<apex:commandButton value="Search" action="{!Populate}">
</apex:commandButton>
</apex:pageBlockSection>
</apex:pageBlock>

<!------Search Result---->
<apex:pageBlock >
<apex:pageBlockSection title="Search Result" showHeader="true" columns="1">
    <apex:pageBlockTable value="{!res}" var="a">  
        <apex:column >
                </apex:column>
        <apex:column value="{!a.Field_1__c}" >
        <apex:facet name="header">
         <apex:outputText value="Object A Number"></apex:outputText>
    </apex:facet>

</apex:column>
                <apex:column value="{!a.Field_2__c}">
            <apex:facet name="header">
             <apex:outputText value="Object A Text"></apex:outputText>
            </apex:facet>
        </apex:column>
        <apex:column value="{!a.Field_3__c}">
            <apex:facet name="header">
             <apex:outputText value="Object A TextArea(Long)"></apex:outputText>
            </apex:facet>
        </apex:column>
        <apex:column value="{!a.Field_4__c}">
            <apex:facet name="header">
             <apex:outputText value="Object B lookup"></apex:outputText>
            </apex:facet>
        </apex:column>
         <apex:column value="{!a.Field_5__c}">
            <apex:facet name="header">
             <apex:outputText value="Object C lookup"></apex:outputText>
            </apex:facet>
        </apex:column>
                          </apex:pageBlockTable>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>

</apex:page>

 

 

This is the searchController

 

public class searchController {
     
      List<List<SObject>> searchList;
       public String srchText ;
       Object_A__c [] res;
        Object_B__c [] res1;
        Object_C__c [] res2;

      
public String getsrchText()
{
  return srchText;
}

public void setsrchText(String newTD)
{
   srchText=newTD;
}

public PageReference Populate()
{
     
   
      String id=srchText;
 
     
     searchList = [FIND :id IN ALL FIELDS
                                     RETURNING
                                     Object_A__c (Field_1__c, Field_2__c,Field_3__c,Field_4__c,Field_5__c),
                                     Object_B__c (Field_1__c,Field_2__c,Field_3__c,Field_4__c),
                                     Object_C__c (Field_1__c,Field_2__c,Field_3__c,Field_4__c)
                                      ];
    
     res= ((List<Object_A__c>)searchList[0]);
     res1=((List<Object_B__c>)searchList[1]);
      res2=((List<Object_C__c>)searchList[2]);
    
     system.debug('Object_A__c' + res);
     system.debug('Object_B__c' + res1);
     system.debug('Object_C__c' + res2);


 return Page.Search;


}
public LIST<Object_A__c> getres()
{
      

   return res;
}

public LIST<Object_B__c> getres1()
{
      

   return res1;
}
public LIST<Object_C__c> getres2()
{
      

   return res2;
}

}

 

I want a common result out of res,res1,res2. And use this ib the Visual force page to display the contents.

Please suggest me the way