Synchronise foundset between forms - again

Questions, tips and tricks and techniques for scripting in Servoy

Synchronise foundset between forms - again

Postby Harry Catharell » Thu Jul 23, 2009 2:49 pm

Servoy Developer
Version 3.5.10-build 524
Java version 1.5.0_19-137 (Mac OS X)

Hi all,

I have two forms based on same table and using same foundset: 'tableA_form' & 'tableA_list'

At some point a user will be on a form from a different table: 'tableB_form' which will be a child record of tableA
On the tableB_form is a button which takes the user back to the parent record using a child-parent relation:
Code: Select all
forms.tableA_form.controller.showRecords(tableB_to_tableA);


This effectively separates the foundsets between 'tableA_form' & 'tableA_list'

What is my best way to synchronise the foundset between these two forms again ?

Cheers
Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Re: Synchronise foundset between forms - again

Postby patrick » Thu Jul 23, 2009 3:13 pm

I think what should do is

forms.tableA_form.controller.loadRecords(foundset)

while this is called from tableA_list
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Synchronise foundset between forms - again

Postby ROCLASI » Thu Jul 23, 2009 3:14 pm

Hi Harry,

If memory serves me right then a controller.loadAllRecords() will relink the (shared) foundsets.
When unlinked then you need to do all the syncing yourself (in your code).

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Synchronise foundset between forms - again

Postby ROCLASI » Thu Jul 23, 2009 3:16 pm

patrick wrote:I think what should do is

forms.tableA_form.controller.loadRecords(foundset)

while this is called from tableA_list


This does indeed load the foundset into the other form but doesn't relink them. So even selecting another record won't show through into the other form.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Synchronise foundset between forms - again

Postby Harry Catharell » Thu Jul 23, 2009 4:26 pm

Thanks for the input guys,

So, given that I do not want to load all records in that particular table in the short term whilst the user is managing records, would I be better off changing my code from being a show records via the relation from tableB to performing a find in tableA based on the parent pk ?
This then may cut out the foundset management between the different views on any table never mind tableA

Cheers
Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Re: Synchronise foundset between forms - again

Postby ROCLASI » Thu Jul 23, 2009 4:43 pm

Hi Harry,

If you don't want to manage the 2 foundsets yourself then I think searching will be the best way.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Synchronise foundset between forms - again

Postby jcompagner » Thu Jul 23, 2009 5:11 pm

ROCLASI wrote:
patrick wrote:I think what should do is

forms.tableA_form.controller.loadRecords(foundset)

while this is called from tableA_list


This does indeed load the foundset into the other form but doesn't relink them. So even selecting another record won't show through into the other form.



this should work fine.

that way tableA will have the same foundset of tableA_list and when you change selection in one or the other both will follow.

But another way to avoid this completely
is to not use the same form as a main form and a tab or child panel.

When you do

forms.tableA_form.controller.showRecords(tableB_to_tableA);

make another instance of that tableA_form and let that show the relation.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Synchronise foundset between forms - again

Postby Harry Catharell » Thu Jul 23, 2009 11:40 pm

I think that here, because of the circumstances and the way that the user needs to work between form and list views, I will use a find/search to isolate the record and maintain the foundset link between forms.

The user workflow is well established and it will be less overhead in keeping the forms in sync

Thanks you all for the replies

Cheers
Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Re: Synchronise foundset between forms - again

Postby bobbydtma » Thu Jul 23, 2009 11:43 pm

We are having exactly the same issue. We use the loadRecords() and then a custom query to load a foundet. We have other forms that we would like to share that custom foundset rather than running the query again for each additional form and then manually keeping track of what row is selected between the various forms, etc. Will there be a way in future releases to link forms with separate foundsets to the same foundset?

The reason we are having this issue is we have table forms and then separate solution model forms below the table holding a table count (aggregate) field. So far this method has worked as expected with the related and standard foundsets, but does not work with tables using loadRecords().
------------------------------------------
Bobby Drake
Software Engineer
TMA Systems, LLC
http://www.tmasystems.com
Servoy 5.2.1
DB: Oracle 10g, SQL Server 2005
OS: Vista 64
User avatar
bobbydtma
 
Posts: 20
Joined: Wed May 06, 2009 8:09 am
Location: Tulsa, OK, USA

Re: Synchronise foundset between forms - again

Postby jcompagner » Fri Jul 24, 2009 12:04 pm

if you want to have a form linked to the same foundset
then when you do stuff with 1 of the forms. you have to set it also on the other .

If 1 form is on a tab of the other.. And you just want to have those 2 (parent<->child) always the same foundset.
we have support for that. make a Self relation
Thats a relation with the same datasource (server/table) on both size and no keys.

Then place the tab on the parent form with that relation. And then those 2 forms will always be in sync.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Methods

Who is online

Users browsing this forum: No registered users and 33 guests

cron