Newbie struggling with Servoy

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

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

Yes, company.z_primary_key is the same as contacts.z_company_id.

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?

Yes,

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

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.