Don, yes I need a form to offer the user a way to select the criteria.
As the SQL is a bit more complex, the use of find will not be my way. I know it is a dirty way of using cake but a long sqlquery-string works just better for me and offers me a nice result so far without learning the complex find (in my case I am using nearly all my models linked with each other) I am not sure about naming files and functions this for and placing them in the right directory. Is it ok to create a "reports_controller.php" containing an action "CreateReport($id,$date)" and 2 views "selectDataSet.ctp", "showReport.ctp" .. pleas feel free to correct my naming as it will not be within the convention so far ;) TIA michael On 31 Mai, 20:20, dreamingmind <[email protected]> wrote: > Michael, > > I'm not sure I see what the problem is. Your link/button can certainly > pass any search parameters you want in to your action. It sounds like > you might be planning to offer a small form for the user to choose > search params? The Form Helper will let you put all that together and > the data will come back to you in $this->data in your action (http:// > book.cakephp.org/view/1383/Form). The action can make use of the > parameters to build a $this->yourModel->find() call. The returned data > will be be passed along to the view because actions by default render > their associated views. All pretty standard stuff unless I'm > misreading your message. > > If you're really planning on writing that sql by hand, you might want > to review thishttp://book.cakephp.org/view/1017/Retrieving-Your-Data > > Regards, > Don > > On May 31, 10:28 am, mivogtGermanyLU <[email protected]> wrote: > > > > > > > > > Hi there, > > > my app has several models with defined relations. > > Entering Data works fine also all the CRUD stuff is fine. > > > Now I need to collect data from the database ostly leftjoined and > > limited and sorted by some definitions... so far as first step I made > > me an SQL statement trying insidephpmyadminand it works fine. > > > To get it more comfortable I would like to have a view offering to set > > the data-limiters. > > In my case it will be a month/year datafield and the id of one model > > all the other stuff is linked somehow. > > > I am not sure about how to go on with this and would be happy to get a > > helping comment... > > > I guess I will need a SelectWhatToReport-View to select month/year/ > > model_id > > passing this to a controller-action CreateReport($month,$year, > > $model_id) > > > in controller I might add the new action > > CreateReport($month,$year, $model_id) > > {sql='select ... where .. $month .. ,$year, .. $model_id' > > // . creating sql result array to be passed to a view > > > } > > > not sure about how to call a 2nd view from controller to display the > > result from SqlResultArray using some while statements ... > > > ok maybe I better rewrite in short sentences what I want to know/need > > to do: > > - need to get a view offering to choose an entry of a model from > > database (sems to be easy I hope) > > - passing this selectioncriteria to controller/action (hopefully just > > by pressing a button) > > - calling a view from controller side to display the result (sql > > array) > > > Thanks in advance > > > Michael -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
