Jump to content

Retrieve record from other table to current crud

GC - Multiple Tables callback custom model

  • Please log in to reply
No replies to this topic

#1 tiagorookie



  • Members
  • Pip
  • 1 posts

Posted 25 June 2018 - 02:20 PM


First of all let me congratulate John Skoumbourdis for the excellent tool he created, as well to @Amit Shah and @davidoster for the support given to newbies in this forum.

I just started using GC and indeed it's a huge step forward in comparison to my excel sheets.


I kindly ask the community for support to help me solve this issue. I really want to get this app started, in order to test it and request professional development to management.


Here it goes:

When I add a new order, the form records the 'customer_id' in the `table_orders`. What I need to retrieve is the 'customer_priority' from the `table_customers` (1 to 50 depending on the customer) and show it in the orders Crud.

That value is going to be the one to set the "order by" to print our daily job list and bring some organization to our department.

What's the best way to do that? I've searched through forums and documentation, tried callbacks and custom models, but so far I haven't figured it out yet.


Bellow is my code and screenshots:

LIST_AMOSTRAS.png - Orders Crud

VIEW_AMOSTRA.png - Order View

LIST_CLIENTES.png - Customers Crud

php_TBL_AMOSTRAS.png - Orders Table 

php_TBL_CLIENTES.png - Customers Table

public function amostras_gestao_hoje(){
$crud = new grocery_CRUD();

 $date = new DateTime("now");
 $curr_date = $date->format('Y-m-d ');

			$crud->where('DATE(data_prevista)',$curr_date);//use date function





			$output = $crud->render();




Also tagged with one or more of these keywords: GC - Multiple Tables, callback, custom model

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users