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
mbforcembforce 

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,

 

Thanks,

Manish

Vinita_SFDCVinita_SFDC

Hello,

 

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:

 

http://www.oyecode.com/2012/07/dynamic-sosl-salesforce-object-search.html

 

http://www.salesforce.com/us/developer/docs/soql_sosl/salesforce_soql_sosl.pdf

 

http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_sosl_syntax.htm