# Newbie struggling with Servoy

**URL:** <https://forum.servoy.com/t/newbie-struggling-with-servoy/573>\
**Category:** Classic Servoy\
**Created:** [November 7, 2003, 5:36pm UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573 "2003-11-07T17:36:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikola](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@Nikola](https://forum.servoy.com/u/Nikola)\
**Post date:** [November 7, 2003, 5:36pm UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/1 "2003-11-07T17:36:43Z")

</div>

Hi!

I have problems with some basics joining of two tables in Servoy. I will describe how I create new Solution, and if I can ask somebody to help me, and tell me where am I wrong. So, let’s go step by step…

Step 0: I have MySQL database on my local machine, and I want to browse data between two tables - Contacts and Company.

Step 1: I create new Solution.

Step 2: on New Form dialog I select my local MySQL database in Using Server drop down, give some name for form (ie. Form1), and select two tables, contacts and company in list menu.

Step 3: I specify field company\_name from table company, and last\_name, first\_name and z\_company\_id (foreign key of table company) to be shown on forms.

Step 4: Now i have to create relationship between tables, so in Top Menu I choose Tools → Relations.

Step 5: In dialog window, after click on New, I select contacts.z\_company\_id = company.z\_primary\_key

Step 6: On company form, I place a Field, with specified field company\_name.

Step 7: After pressing Ctrl+L, I can browse records from table contacts, but I do not have listed proper company\_name.

Can somebody help me with this, I think it I minor problem, but it really takes me a lot of time.

Thank you in advance!

Nikola

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [November 8, 2003, 4:52pm UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/2 "2003-11-08T16:52:05Z")

</div>

Is company.z\_primary\_key is the same as contacts.z\_company\_id ?? in most cases the column names matches like:  
contacts.z\_company\_id = company.z\_company\_id

---

<div class="post-metadata">

**Author:** ![Nikola](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@Nikola](https://forum.servoy.com/u/Nikola)\
**Post date:** [November 9, 2003, 12:34am UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/3 "2003-11-09T00:34:26Z")

</div>

Yes, company.z\_primary\_key is the same as contacts.z\_company\_id.

---

<div class="post-metadata">

**Author:** ![maarten](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@maarten](https://forum.servoy.com/u/maarten)\
**Post date:** [November 10, 2003, 9:52am UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/4 "2003-11-10T09:52:50Z")

</div>

Hi Nikola,

I’m not really sure what you’re trying to build.

Do you want a companydetails screen with a tabpanel/portal that shows related contacts?

---

<div class="post-metadata">

**Author:** ![Nikola](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@Nikola](https://forum.servoy.com/u/Nikola)\
**Post date:** [November 10, 2003, 11:03am UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/5 "2003-11-10T11:03:29Z")

</div>

Yes,

I want a Company Detail screen, with a tabpanel/portal that shows related Contacts.

---

<div class="post-metadata">

**Author:** ![maarten](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@maarten](https://forum.servoy.com/u/maarten)\
**Post date:** [November 10, 2003, 12:25pm UTC](https://forum.servoy.com/t/newbie-struggling-with-servoy/573/6 "2003-11-10T12:25:03Z")

</div>

Ok , this means you have to look at your solution from the company table’s perspective.

1. TABLE companies should have columns(z\_contact\_id(PK), company\_name,etc..)  
TABLE contacts should have(z\_contact\_id(FK), firstname, lastname, etc…)

2. create the relation “companies\_to\_contacts”  
(companies.z\_company\_id :: contacts.z\_company\_id)

3. go to your companyDetails form and create a tabpanel based on the above relation \<companies\_to\_contacts.“contactsList”\>. (where the quoted string “contactsList” is your other form showing contacts)

Hope this helps.
