Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

How to use relational tables in j-cook? 05 Dec 2012 12:10 #5836

How to use relational tables in j-cook? is it possible?

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 13:05 #5838

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi and welcome!

Relating tables is pretty straight-forward thanks to cook!

Lets say you have 2 tables - families and family_members each with an id (auto created in cook) and a name field + in the family_members table, add a foreign key field type called family. Then, from your tables list on the left-hand side, drag the families table into the dashed div and click the save button. That's it! Simple, eh?

Now all you have to do is create a layout to enter and view data for both tables. When you do this and you drag your fields to the layout, simply click the + sign on the foreign key field (family) and drag one of the related fields from that table to your layout. This is what you'll see in your layout - either in the combo dropdown on your form or in a grid/fly.

Hope it helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:28 #5842

what you describe is a 1 to 1 relationship right?

because I need a 1 - n relationship

Please Log in or Create an account to join the conversation.

Last edit: by jcasanova.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:31 #5844

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi,

No this is a 1 - many relationship. You could add multiple family members to a family in this example.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:40 #5845

so, if its 1 - n its not working =(

I added 2 families

then in family members added 2 names with the same family,

and this create 2 regs with the family but both with and unique Id....

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:47 #5846

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Yes, but there is only one family id there - your foreign key. 1 family->many members = 1-n
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:48 #5847

I should be able to open a family en see the family members

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:51 #5848

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
You need to create a layout for that - 1 where you filter by family and show related members. What you are currently looking at is family members from all families.

You'd need separate query - prepareQuery() function in your model to get say family 1 and all of it's members.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:54 #5849

Ok, but that cant be done here in jcook right?

can you tell me the use of "default" in table it s like "primary key" ?

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 14:58 #5850

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
there's a few things you can do:

1 - add a filter to the table based on your family
2 - group by family (find this in your grid properties of the layout
3 - as I said before, add a where clause in a new 'case' so you can switch to filter by family.id (after download)

Hope it helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 15:05 #5852

thanks I'll try, when Paid the account, in order to download (when I'll be satisficed that cook fill my needs)

I got a problem with the relation

I added the relation to the view... and added the field from the FK table, the field is an BOOLEAN
when I added to the layout it shows a dropdown empty.

What happens there?

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 05 Dec 2012 15:08 #5853

I can only add just 1 record from the fk table??????

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 06 Dec 2012 13:08 #5861

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yes of course.

1:N is linking only one foreing element.

If you want to connect multiple, you need N:M.

N:M is possible manually in Cook. Then to show them you must code a little bit.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: How to use relational tables in j-cook? 06 Dec 2012 16:35 #5864

Admin, thanks, I just paid the 6 months! (not with this account) I'm very exited!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.083 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started