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
Mike OtterMike Otter 

Need guidance for Input fields to a query, displaying results on same/different page

New and mostly ignorant of Apex, I come to you for help.  :)

I have a custom object that I want to search using two input fields from a VF page.  Inputting the fields is straightforward but, since this is complicated (to me), I'm a bit lost as to a working solution.  I think I need to do the following:
  • accept the input as strings in a custom controller or an extension (am going to try an extension today)
  • build the query
  • execute the query (my code always says the input variable is null)
  • populate a list datatype
  • display the list on the same page's bottom half (previously hidden) or a second page entirely (the former would be cool but don't care at this point)
I have done tutorials from VisualForce in Practice, Force.com, a couple of workbooks, and numerous code examples in a reference section.  Over the past two days, I've tried different combinations for each of the above bullets but keep getting blocked.  The query runs with a null value, the query returns more rows than expected and the VF page can't display them, the return type is not the same as expected--all I get is frustration.

What adds to my frustration is knowing that this is the most basic of exercises.  A step beyond "Hello world" is running a query to show just your Cases, not all of them.  Apex's versatility means there's no one solution to any problem but, yegads, what I want cannot be that complicated--I just can't figure it out.

Thanks for letting me vent and, as always, thanks in advance.

Mike
Best Answer chosen by Mike Otter
Mike OtterMike Otter
I found the answer through a couple of answers and mostly chance.  My similar question (answered and with working code) can be found at http://salesforce.stackexchange.com/questions/42159/how-to-accept-inputfield-to-filter-a-query-and-then-display-results/42160?noredirect=1#comment55842_42160.

Thanks.

All Answers

Ramu_SFDCRamu_SFDC
The following article might help

http://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/
Mike OtterMike Otter
Thanks @Ramu_SFDC.  I saw it yesterday and, although the cool factor is extremely high, what I'm doing will be replaced by an API call and don't want to try his solution just yet.  I started this Monday figuring it was so easy I could be done by evening but have gotten nowhere.  I guess I still need to vent.  :)  I keep thinking I'm so close to a solution....
Mike OtterMike Otter
I found the answer through a couple of answers and mostly chance.  My similar question (answered and with working code) can be found at http://salesforce.stackexchange.com/questions/42159/how-to-accept-inputfield-to-filter-a-query-and-then-display-results/42160?noredirect=1#comment55842_42160.

Thanks.
This was selected as the best answer