⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Set Relation Function For Joing Multiple Tables



Neelim Sahariah

Neelim Sahariah
  • profile picture
  • Member

Posted 22 March 2017 - 15:42 PM

Hi All,

 

I am new to Grocery Curd. I am working with relations and able to use the set relation function to join tables. However I need to join three tables to get a consolidated view of some data. I have attached an image of table structure with  sample data and desired output. Please help me on retrieving/updating the data in the format i have mentioned.

 

Thanks in advance!


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 27 March 2017 - 09:09 AM

Hi Neelim Sahariah

 

Can yo please explain in as what is it that you are looking in for as a solution. We can understand the table structure.. but what is it that you wana display / select in the form / list. If u can clarify .. where is it you finding the difficulty it will be much clearer to understand and provide u solution


Neelim Sahariah

Neelim Sahariah
  • profile picture
  • Member

Posted 03 April 2017 - 03:16 AM

I have three tables, . in the view mode I want to display the following columns product_category_name, product_name, product_code, price_n, rawmterials_name, quantity and supplier detail.
by joining all three tables, In the edit action all the fields I want to show. once saved it will update data in tb_product_master and tb_product_rawmaterial_Details table. I am not able to join the tables using set relation function to display in view and edit action. How can I achieve this?


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 April 2017 - 06:08 AM

Sorry for delay - unfortunately was more of out of time. As for update on the same,

If u wana show something with nested relations.. u will not be directly .. possible with the existing code .. but u have an option for callback.

As the same goes, when u want to do the same with insert - u got to do it with adding extra fields .. determining the field types as required. And a callback for insert or after insert ... where u have opportunity to handle the insert your way or u may do the extra inserts in other tables post the insert of the record.

 

Happy GCing :)