You need to sign in to do that
Don't have an account?
intern24
Help with passing variables to soql.
Hi, I was wondering how to pass a variable to soql. I am trying to make a vf page that has three parameters and a button. I want to enter in the values and then hit the submit button. This would then search through my object for the three parameters and if there is a match display that person's data. For example, John doe, 1/12/2009, 1/20/2010. (These are the parameters). Thanks for any help you can give.
intern24,
You have to assign the value in each of the text fields to a corresponding parameter in your controller. Once you do this, you can use the parameter in your controller by passing it into a dynamic SOQL query.
Examples are below
VisualForce page:
Controller:
Also to note, the VisualForce Developer's Guide (http://www.salesforce.com/us/developer/docs/pages/index.htm) has examples on how to do this, as well as many other tasks.
I would recommend taking a look at this as you get a chance, to familiarize yourself with the platform. It has proved useful to me on many occasions.