You need to sign in to do that
Don't have an account?
Rima
How to display SOQL query results
Hi All,
Following is my Apex code:
Public class SOQLController{ public String objectName { get {return objectName ;}set{ objectName = value ;}} public String zipCode { get { return zipCode ;} set { zipCode=value ; } } public List<sObject> queryResult { get{return queryResult;}set{ queryResult = value ;}} public PageReference query(){ String zipFieldName ; if( objectName == 'Account' ){ zipFieldName = 'BillingPostalCode' ; } // create the query string String qryString = 'SELECT Id FROM ' + objectName + ' WHERE ' + objectName + '.' + zipFieldName + '=' + '\'' + zipCode + '\'' ; // execute the query queryResult = Database.query(qryString) ; return null; } }
Following is my reference link :
http://blog.sforce.com/sforce/2008/09/dynamic-soql--.html#comment-6a00d8341cded353ef0120a8f1e8b3970b
I am not able to disply retrieved id's when I give value to Zip code and click on query button. Could anyone please let me know how to display query result? Your help is greatly appreciated.
Hi,
I did figure out how to display results on VF page.