Working with two different database table in the form

Questions and answers for designing and implementing forms in Servoy

Working with two different database table in the form

Postby hardina09 » Thu Apr 26, 2012 3:35 pm

I have created a form with labels and text field. Need to validated data once user enter data against data in two different (database) unrelated tables.

As the form is bound to one datasource, how I can create two datasource for two different database table?

Please guide.
Thank you in advance.
hardina09
 
Posts: 62
Joined: Tue Apr 24, 2012 9:46 pm

Re: Working with two different database table in the form

Postby ngervasi » Thu Apr 26, 2012 4:31 pm

You can create a new form for the second datasource and show that in an unrelated tab panel of the first form.
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: Working with two different database table in the form

Postby ngervasi » Thu Apr 26, 2012 4:35 pm

I've read again your post, maybe I've been too quick in replying.
If you only need to show/get data for one datasource one form is enough, if you then need to validate against that datasource and another one you can use something like this:

Code: Select all
if(forms.a.my_column) .... // main datasource checks...

var _foundset = databaseManager.getFoundset('my_server','my_table')
_foundset.find()
_foundset.my_column = 'whatever' // load the records that you need to check against
_foundset.search()

if(_foundset.getRecord(1).myOtherColumn) // checks on the first record of the foundset


I hope you get the idea..
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: Working with two different database table in the form

Postby hardina09 » Thu Apr 26, 2012 6:46 pm

Thanks for the quick response.

Can you please provide me more information for to load particular column records in foundset

Thank you once again
hardina09
 
Posts: 62
Joined: Tue Apr 24, 2012 9:46 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 10 guests