Can a grid, or report, be created from many tables?
10 posts
• Page 1 of 1
Can I pull together data from two, or more, tables, and display that data in a single grid? Or can I create a report using data from many tables?
I am looking for data from different tables to be displayed, all at once.
The best way to do this is with a custom action.
You can use the Dataface_RecordGrid class if you want to layout the results in a nice format. e.g.
Then you would access this action using index.php?-action=reports -Steve
Definitely actions are getting right into the deep stuff.Ê With Dataface it is much easier when you can start thinking the dataface way.Ê If we are jumping directly into actions there is a good chance that we're approaching the problem the hard way. I use custom actions with multiple table SQL queries usually just to print a special report of some kind.Ê The rest of the time we should be able to get by just navigating one table at a time - possibly with some calculated fields to add important information to each record. If you need help - please post, and I'll do my best to steer you in the right direction.-Steve
I tried a simple test and, as you might expect, it didn't work for me. I'm sure I overlooked something simple.
These are the only two lines that I modified: $sql = "select * from name"; $res = mysql_query($sql, df_db('hoadb')); This is my error: Fatal error: Class 'dataface_actions_reports' not found in /var/www/dataface/Dataface/Application.php on line 851 The location: "/var/www/dataface/Dataface/Application.php" is correct, that is where the file is located.
Have you read the tutorial pages on custom actions?Ê Please note the locations specified in there of where you should place your actions. -Steve
I read this:
https://framework.weblite.ca/documentation/tutorial/getting_started/dataface_actions I then created a /var/www/hoadb/actions folder, and put reports.php in that folder. I deleted reports.php from the /var/www/dataface/actions directory. This launches my application: http://localhost/hoadb/ This gets me the following error: http://localhost/hoadb/index.php?-action=reports Fatal error: Class 'actions_reports' not found in /var/www/dataface/Dataface/Application.php on line 851 BTW: I set permission on the actions directory and the reports.php file to 777. If I change "action" to "actions" like this: http://localhost/hoadb/index.php?-actions=reports I don't an error, but I don't get any results either.
Please post the content of your actions/reports.php file.
Probably you didn't place it inside a class. e.g. the contents of this file should at least have: class actions_reports { function handle(&$params){ .... your stuff here .... } } -Steve
The reports.php files is copied from your earilier post. I only changed these two lines:
$sql = "select * from name"; $res = mysql_query($sql, df_db('hoadb')); The function handle(&$params) from your earlier post was function handle() I tried changing that, but it didn't make a difference. The hello.php from the tutorial worked fine. I tried deleting and rebuilding my application with ./makesite but I still get the same error with reports. Here in the complete file: db())); $data = array(); while ( $row = mysql_fetch_assoc($res) ){ $data[] = $row; } import('Dataface/SkinTool.php'); import('Dataface/RecordGrid.php'); $grid = new Dataface_RecordGrid($data); df_display(array('body'=>$grid->toHtml()), 'Dataface_Main_Template.html'); } }
Never mind. I got it. I was just missing a closing php bracket i.e. "?>". I am really sorry, I feel stupid.
10 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 34 guests |