Global Method to load all table records into a foundset

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Global Method to load all table records into a foundset

Postby DFehrenbach » Thu Feb 26, 2004 6:09 pm

I'm currently working on loading database files from files exported from a FMPro solution. Typically, number of records is high 30,000 40,000 is typical. After importing I need to view the records in a list, but the limitation of Servoy anly loading 200 records at a time is slowing me down. Can anyone suggest a global method that I could run on any form that would go out and load all records in the file to the found set? I don't care so much about the performance, since this this is only to be run in Developer.
DFehrenbach
 
Posts: 252
Joined: Sat Sep 13, 2003 6:48 pm
Location: Cleveland, OH

Postby IT2Be » Thu Feb 26, 2004 6:29 pm

You can now do (RC7):

Code: Select all
controller.loadRecords("SELECT <tablepk> FROM <table>)


However I don't know if this lifts the limitation...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby DFehrenbach » Sat Feb 28, 2004 6:50 pm

Is this the only documentation for this function?
Function loadRecords(pkdataset) Description Loads the specified form with the primary key's column data as the foundset. Requires a dataset with only the primary key's column data from the table the form is based on. NOTE: This function will work best when the dataset that is retunred is approximately 200 rows (records). This function should not be used if the returned dataset is too large (as in thousands of rows). Example var query = 'select orderid from orders where orderid in (10300,10301,10302);var pkdataset = databaseManager.getDataSetByQuery(controller.getServerName(),query,null,100);controller.loadRecords(pkdataset);

I would like to know more about how and when to use this, but this is all I've found.
DFehrenbach
 
Posts: 252
Joined: Sat Sep 13, 2003 6:48 pm
Location: Cleveland, OH

Postby DFehrenbach » Sun Feb 29, 2004 3:56 pm

Perhaps a little background to this request is needed.
I created a table of names with an initial set of data (about 2000 records) from and Excel file. Since the table was to contain foreign keys related to records in other tables in the solution, I could not import directly from the Excel file, so I created a method to read each loaded record and write the real table record after translating the various related foriegn keys.
I created methods to look up names in the file a la mattman's rapid search technique. So far so good. My next step was to create various other many-related files for cross reference information, phone numbers, email addresses and the like.
Later, I wanted to expand the sampling of test data. Since there were other files in the solution that require similar loading, I created another solution in the same DB connection to do all of the loading and conversions and loaded another 20,000 records.
When I went back to the main solution to try the search technique, it would only retrieve records from the first 2000 records. When I went to view the records in a list view, I noticed that each time I expanded the found set (by 200 records) those records then were then retrieved by the search method. Is this normal behaviour?
My initial question was related to trying to expand the found set with the entire populated file, but I suspect that there may be other issues that need to be investigated.
Any help you could give me would be greatly appreciated.
DFehrenbach
 
Posts: 252
Joined: Sat Sep 13, 2003 6:48 pm
Location: Cleveland, OH

Postby admin » Tue Mar 02, 2004 3:12 pm

I'm still not sure what you exactly want to do. Do you want to show 40,000 records in one foundset? Then you can use:

Code: Select all
while(controller.recordIndex < controller.getMaxRecordIndex())
{
    controller.recordIndex = controller.getMaxRecordIndex()
}


That will take a while depending on your machine capacity.
admin
Site Admin
 
Posts: 72
Joined: Wed Apr 23, 2003 4:29 pm

Postby DFehrenbach » Tue Mar 02, 2004 4:38 pm

Yes, I want to show 40,000 records in one found set only because that seems the only way to get the records to be "found" the first time they are searched. As I mentioned in an earlier post I am very concerned that after I loaded the records (this happened in a different solution in the same database connection) those loaded records are not found when I perform a search in the main solution, unless the main solution somehow "blesses" these records by retrieving them at least once. This doesn't seem right to me. :?
DFehrenbach
 
Posts: 252
Joined: Sat Sep 13, 2003 6:48 pm
Location: Cleveland, OH

Postby jcompagner » Tue Mar 09, 2004 8:37 pm

How do you do that import?
Is the import a comma separated file or something?

Why would you load all the records??
What do you mean you can't search for it before loading all the records?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Programming with Servoy

Who is online

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