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
ethan huntethan hunt 

Display Records by selected date range and selected object from picklist

Hi,

 

I have a visualforce page where i have a from date and to date field and a picklist which has all objects. There is a command button.

 

We have to select from date and to date and select a object from picklist and when pressed, it will display all the records in that object.

 

Need Help

----

<apex:page controller="objectLists">
   <apex:form >
    From Date :<input type="date" name="frmday" id="fday"/>
    To Date :<input type="date" name="today" id ="tday"/>
    <apex:SelectList value="{!val}" size="1">
       <apex:selectOptions value="{!Name}" id="list"></apex:selectOptions>
     </apex:SelectList>
     <apex:commandButton value="Display" action="{!display}"/>
   
   </apex:form>
   <apex:pageBlock ></apex:pageBlock>
 </apex:page>

 

---controller --

public class objectLists{
String searchText;
  List<Lead> results;
  public String val {get;set;}
  public String objName { get; set; }
  List<Account>  lstaccount = new List<Account>();
  public List<SelectOption> getName()
 {
    List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();  
    List<SelectOption> options = new List<SelectOption>();
    for(Schema.SObjectType f : gd)
    {
     options.add(new SelectOption(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
    }
    return options;
    }

P8DEMOP8DEMO
You want a dynamic query which query the records of the specific object from which the last modified date are between fromDate and toDate ?
ethan huntethan hunt

Hi,

 

Could you please modify my controller with the dynamic query to achieve the requirement.

 

Regards