Display records of two table in form.

Questions and answers for designing and implementing forms in Servoy

Display records of two table in form.

Postby mskv1309 » Mon May 07, 2012 4:49 pm

I need to perform following things in my form

1.Want to display all the data from the 2 table (specified columns from two table).
2. When user select/click on a row should navigate to other form, displaying selected row in respective elements.

How can I accomplish it.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Display records of two table in form.

Postby Joas » Tue May 08, 2012 9:39 am

1. Do I understand correctly that you want to show a table view with columns from 2 different tables?
Important to know is how the two tables are related to each other. The most common way is to create a relation from table1 to table2. Create a form with datasource table1 and with the view-property set to "Table view". Then place a couple of fields from table1 on your form and a couple of fields from table2 using the relation table1_to_table2.

2. Create another form with datasource table1 but now with view set to "Record view" and put all the fields you want on there from table1 or using the relation. By default the two forms will share the same foundset, so you don't have to care about loading records. Now create a method on your first form that shows the second form:
Code: Select all
forms.yoursecondform.controller.show();
You can attach that method for example to a button on your first form.

Does this answer your question?
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: Display records of two table in form.

Postby mskv1309 » Tue May 08, 2012 4:32 pm

Joas,
Thanks for the reply. Yes you got it correct.

1. The thing is that I need to create relation for three table for eg. employees, empworkdetails and departments and use this relations for table view
2. I want to place the field other than the relations. how to accomplish that.

And for 2# I got your point.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Display records of two table in form.

Postby mskv1309 » Tue May 08, 2012 8:05 pm

I am able to do that.

I created a table view based on above discussion. I need to add header to table view and even want to make this table view select only, user can click on any field entire row get selected.
That selected row should get populated in record view (as mention above #2 in Joas Coment
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm


Return to Forms

Who is online

Users browsing this forum: Bing [Bot] and 7 guests

cron