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

Need help with constructing Dynamic SOQL query

Hi All,


I am in learning phase of Visualforce and Apex, I have created 2 object Student and Course with following fields


Student - Student Name, address, DOB, Phone Number, Course joined

Course - Course Name, Start Date , end date, Fees,


I have created a VF page with four textbox (Student Name, Course, Start date, End Date)


user will enter value in any of these boxes and click search button on VF page I want to construct Query based on user input

e.g. if user input Student Name as John and Course as SFDC and click search button, query should retrieve details (Student Name, course Name, start date , end date, fees) of all the student with name john and enrolled fo course SFDC


Note: Object Student and Object Cource have many to many relationship   


Please help,







The search buttion will call an action ( a method) in controller. The method will have the quey for the search using a dynamic SOSL.


Please refer following links for further details: