selectRecord in 200+ foundset

Hi all,

I make use of the convenience of myRcd = fs.selectRecord(PK1, PK2), thus providing lookups in static tables.

As I understand Servoy only loads 200 records at a time…

So, if I:

	var fs = databaseManager.getFoundSet('server', 'table'); 
	fs.loadAllRecords();

Do i hit an entry if the (searched) index is 200+ ?

( My debug view stops viewing at record 200… )

In other words: Can this technique be geneally used? or should i use SQL

Kind Regards, Jan

Jan,

fs.selectRecord() only selects the record if the pk is loaded, it does not query the db.
Servoy lazy-loads foundset in chunks of 200 (also with loadAllrecords()), so if your pk is not loaded yet, selectRecord will fail.

Either do fs.loadRecords(dataset), it will query the db, but the foundset will only contain your pks.
Or load the entire foundset (for example, via a loop over the foundset), but note that this will load all pks in memory.

Hope this helps,
Rob

Hi jan,

we can select record from a foundset of 200+ records. By using the following logic. But it might be time taken if the foundset contains lakhs of records.

var result = foundset.selectRecord(pk);
var fsCount = databaseManager.getFoundSetCount(foundset);
while(result==false)
{
if(fsCount == foundset.getSize())
{
return;
}
foundset.setSelectedIndex(foundset.getSize());
result = foundset.selectRecord(pk);
}

Hope it may helpful to you.

Thanks
Chaitanya

Thanks Chaitanya,

Nice one :) to do it with foundset
But It seems (to me) a lot of fuzz, just to get a record field based on a set of pk’s

I will use: databaseManager.getDataSetByQuery instead

Regards Jan