Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Related Table Fields

[SOLVED] Related Table Fields 30 Sep 2011 18:00 #54

  • griiettner
  • griiettner's Avatar
  • Offline
  • Senior Member
  • Posts: 73
  • Thank you received: 12
  • Karma: 8
Hello,

I'm working in a demo version of a component, just to test your tool, and so far I have no complains, because it really make things to work, but I have a question and want to know if this is possible.

I created 4 different tables for my Airport demo component:

Airport table with the following fields:
id | airport_name | airport_code | city_id

City table with the following fields:
id | city_name | state_id

State Table:
id | state_name | state_code | country_id

Country Table:
id | country_name | country_code

As you can notice, we have a relationship between than, for isntance, where on City Table I call the id from State table... I think I could do this relationship, but, I was expecting, on my form, to have some sort of dropdown select, where I could select witch state belongs to the city. Is that doable, or after I create the scheleton, I have to do this relationship outside the cook?

I do not mind do this after, but I'm asking if it currently possible, so it would save even more work...

Thank you gain...
Paulo Griiettner
Last Edit: 01 Oct 2011 20:22 by griiettner.
The administrator has disabled public write access.

Re: Related Table Fields 30 Sep 2011 18:06 #55

  • doob
  • doob's Avatar
  • Offline
  • Junior Member
  • Posts: 22
  • Thank you received: 2
  • Karma: 5
First I think you doesn't need id fields :) second in 1...* connections use foreign type for key holding! ( and add your child table ) it will be work ...
The administrator has disabled public write access.

Re: Related Table Fields 30 Sep 2011 18:09 #56

  • doob
  • doob's Avatar
  • Offline
  • Junior Member
  • Posts: 22
  • Thank you received: 2
  • Karma: 5
airport_name | airpotr_code | foreign for city

city_name | foreign for state

state_ name | state_code | foreign for country

country name | country_code
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Related Table Fields 30 Sep 2011 18:26 #57

  • griiettner
  • griiettner's Avatar
  • Offline
  • Senior Member
  • Posts: 73
  • Thank you received: 12
  • Karma: 8
Hello Doob and thanks for your help...

1 - I did not create the ID fileds, I jsut mentioned, because if I look to the table, I see it there and had figured before that the software would create the ID field

2 - I did create a foreing key field and added my table inside... this step I had figured out as well, but on my form, I ave to input the State ID on a text input box. I was trying to see if the app creates the select box. Like I said, I can create the select box myself, but I was wondering if the app does this job already.

One the suggestions would be to have an option of how the filed would be handled... like radio input, checkbox input, select input and so on... or even a free way to customize this... but anyway, this is just a suggestion, because the system in the way the it is today, already does a lot.
Paulo Griiettner
The administrator has disabled public write access.

Re: Related Table Fields 01 Oct 2011 09:27 #62

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
If I understand, you want a select box (dropdown) to select the country of a city item.

When you compose your form layout taking fields from the tree, if you choose the foreign key (State ID in your project), it will place a single input box.

To show a select, Cook must known which field of the foreign table to show (ex: title, desc, ...). In your case, I think you want to show "State name".

So to do this :
1 - Remove the ID key from the form (State ID > ID)
2 - Open the tree node "State ID"
3 - Drag the "State name" to your form

that's all !

Important :
- You cannot go more than 1st level tree in the form (pure logic)
- You cannot place two time the same field in the same form (logic too...)
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Related Table Fields 01 Oct 2011 09:28 #63

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Thank you doob

Karma +1
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Related Table Fields 01 Oct 2011 09:34 #64

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
To easily change the handler (select, radio, checkboxes, ...) You can change it in your layouts or in the final template files.

JDom alows you this in seconds, because the protocol is the same for all HTML controllers.

We are preparing some documentation.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Related Table Fields 01 Oct 2011 20:22 #67

  • griiettner
  • griiettner's Avatar
  • Offline
  • Senior Member
  • Posts: 73
  • Thank you received: 12
  • Karma: 8
WOW.. WOW... WOW...

This is awesome... in less than 3 hours of work I have my application done... this is simply the best tool I ever tried to generate Joomla Components...

Thank you very much for this tool and your answer.. it helped me a lot...

My friends here in Brazil are going nuts with this...
Paulo Griiettner
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Related Table Fields 03 Jan 2012 15:34 #802

  • tessak22
  • tessak22's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: -1
I dont understand what the tree node is?
The administrator has disabled public write access.

Re: Related Table Fields 03 Jan 2012 15:43 #803

  • tessak22
  • tessak22's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: -1
SO confused. I cant drag a field from one table to another tables form, it wont let me.
The administrator has disabled public write access.

Re: Related Table Fields 03 Jan 2012 15:47 #804

  • tessak22
  • tessak22's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: -1
AWWWW there is a plus sign next to the assigned foreign key fields!
The administrator has disabled public write access.
Time to create page: 0.107 seconds

Get Started