Tuesday, May 31, 2011

Best practise? Creating a detailed data report from different linked models?

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 inside phpmyadmin and 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: