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
Romil GuptaRomil Gupta 

how to add new row to view last search/submit dae and time.

User-added image


public class AccountExtension1 
{
            private final Account acct;
            public Account acco{get; set;}
            public List<Account> objacc{get; set;}
             public string query1{get; set;}
               public string conditionprefix = ' WHERE';

      
        
    
            public AccountExtension1(ApexPages.StandardController stdController)
            {
                this.acct = (Account)stdController.getRecord();

            }
   
            public void  check1() 
            { 
                query1= 'SELECT NAME , BillingCity,BillingState,BillingCountry,OwnerId,Industry,Hobbies__c,NRI__c,SLAExpirationDate__c  from Account';
                
                if(acct.BillingState!=null)
                {
                    query1 = query1 + conditionprefix + ' BillingState = \''  +acct.BillingState + '\'  ';
                        conditionprefix = '  AND ';
                    
                }
                if(acct.OwnerId!=null)
                {
                    query1 = query1 + conditionprefix + ' OwnerId = \''  +acct.OwnerId + '\'  ';
                        conditionprefix = '  AND ';
                    
                }
                if(acct.Industry!=null)
                {
                    query1 = query1  + conditionprefix +' Industry = \''  +acct.Industry + '\' ';
                    conditionprefix = '  AND ';
                }
                if(acct.Hobbies__c!=null)
                {
                    query1 = query1 + conditionprefix +'  Hobbies__c includes (\''  +acct.Hobbies__c + '\') ';
                    conditionprefix = '  AND ';
                }
                if(acct.NRI__c!=false)
                {
                    query1 = query1 + conditionprefix +'  NRI__c =' + acct.NRI__c ;
                    conditionprefix = '  AND ';
                }
                if(acct.SLAExpirationDate__c!=null)
                {
                    query1 = query1 + conditionprefix +'  NRI__c = \''  +acct.NRI__c + '\' ';
                    conditionprefix = '  AND ';
                }
                 
                                objacc = database.query(query1);
                
                

            }
            
}


//visual force page..............


<apex:page standardController="Account"  extensions="AccountExtension1" showheader = "false" sidebar = "false">
    <apex:form>
        <apex:pageBlock title="My Content">
            <apex:pageBlockSection>
                
                <apex:inputField id="theTextInput3" value="{!Account.BillingState}" />
                <apex:inputField id="theTextInput5" value="{!Account.OwnerId}" />
                <apex:inputField id="theTextInput7" value="{!Account.Industry}" />
                <apex:inputField id="theTextInput8" value="{!Account.Hobbies__c}" />
                <apex:inputField id="theTextInput9" value="{!Account.NRI__c}" />
                <apex:inputField id="theTextInput10" value="{!Account.SLAExpirationDate__c}" />
                  
            </apex:pageBlockSection>
            <apex:pageBlockButtons>
                <apex:commandButton value="Submit" action="{!check1}" >                
                </apex:commandButton>
                
        
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection>
            
        <apex:outputtext style="border:1px; background-color:#F3F3EC;" value="{!query1}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>    
                        

               <apex:pageBlock>
                    <apex:pageBlockTable value="{!objacc}" var="data" >
                                 
                                   <apex:column headerValue="Name" value="{!data.Name}"/>
                                 <apex:column  headerValue="BillingCountry" value="{!data.BillingCountry}"/>
                                <apex:column headerValue="BillingState" value="{!data.BillingState}"/>
                                <apex:column headerValue="Owner Name" value="{!data.OwnerId}"/>
                                <apex:column headerValue="Industry" value="{!data.Industry}"/>
                                <apex:column headerValue="Hobbies" value="{!data.Hobbies__c}"/>
                                
                                  
                                
                                
                    </apex:pageBlockTable>
                </apex:pageBlock>
                
</apex:form>

<!-- End Default Content REMOVE THIS -->
</apex:page>