merge foundsets

Questions, tips and tricks and techniques for scripting in Servoy

merge foundsets

Postby Hans Nieuwenhuis » Sat Aug 28, 2010 7:18 pm

Hi,

I have two foundsets based on the same table.

I would like to merge the two into one new foundset. Can that be done ??

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: merge foundsets

Postby michel » Mon Aug 30, 2010 9:10 am

This can be done using the foundset query, something like:

Code: Select all
new_foundset_query = "select table_id from table where table_id in ("+foundset_query_1+") or table_id in ("+foundset_query_2+")"
Michel van Klink
Vision Development
michel
 
Posts: 186
Joined: Mon Sep 22, 2008 10:53 am
Location: Boskoop, The Netherlands

Re: merge foundsets

Postby Hans Nieuwenhuis » Mon Aug 30, 2010 10:06 am

Thanks Michel,

I thought of this option too.

But this means another roundtrip to the database.
If I can merge the foundsets directly I do not need to go to the database.

Regards,
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: merge foundsets

Postby pbakker » Mon Aug 30, 2010 10:27 am

A foundset is defined by it's underlying SQL () the from clause, with joins, the where clause, the ordering etc.

So, merging 2 foundsets means getting the 2 SQL's combined. There's no way to do that, except for the way michel says, unless...

If you have one foundset you can extend the set of records in there by a find/search with the correct arguments for the search command. So, if you have "know" what defines the second foundset, that might also be a way.

But, in both cases, there will be a roundtrip to query just the PK's again. Any record data that was already loaded will not be re-queried.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: merge foundsets

Postby Hans Nieuwenhuis » Mon Aug 30, 2010 10:50 am

Thanks Guys,

Will try this.
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 10 guests