What is the difference between a foundset and a dataset?
A foundset is the data cache that servoy manages for you. It is an abstraction of a set of records in a database. This is the layer between you and all the SQL you would have to generate in order to read and write data.
Servoy allows you to scroll through, edit and update a foundset with a few simple commands. It will generate and execute the SQL behind the scenes
The convertToDataSet(foundset) does a conversion but what is the difference between the two?
A dataset is really just a two-dimensional data container, kind of like a snapshot of a foundset. It is not connected to anything. If you call the method:
convertToDataSet(foundset)
The resultant dataset object is fixed and will not change regardless of what happens to the database (or original foundset)- whereas the foundset will always reflect what’s going on in the database.
I am looking to update a table that is not related to the login form for my application.
I don’t know what you mean by this You want to update a different table immediately following login?? Can you be more specific?
rvpm:
What is the difference between a foundset and a dataset. I can not find a definition of a dataset anywhere.
The convertToDataSet(foundset) does a conversion but what is the difference between the two?
In essence they do the same thing. They point to a set of data as a result of a query.
The big difference though is that a dataset is in no way related to a form and doesn’t have any of the constraints that come with that (like outer joins, although Servoy 3.5 fixes this, and other constraints).
Also with a dataset you can select a specific set of columns while with a foundset you in fact only have a set of PK’s so each time you want a column value Servoy has to fetch that seperately.
rvpm:
var query = "SELECT * FROM mytable WHERE user_ID = '" + myuser_ID + "'";
var dataset = databaseManager.getDataSetByQuery(servername, query, null, 10);
I know that the above query does not have to be related to the current form but I would expect the same from:
With the first query you fetch first of all ALL columns of the table but you also limit the resultset to 10 records.
The second query will select only the PK column of the table and Servoy will fetch the first 200 records of the set. If you display any of the records in a form then Servoy will fetch the columns for the records you are using in your form. So it queries the columns ‘On-Demand’.
rvpm:
I am looking to update a table that is not related to the login form for my application.
I can read the values in the fields that I wish to update but have been unsuccessful in updating them.
You don’t have to show a form to be able to update it’s records.
You can simply use forms.myOtherForm.myOtherColumn = “new Value”; .
So if you want to edit records of another table just create a form for it (if you not already had one for it) and talk to it from another form.
There are other ways too but this one is the simplest.
Reading Sean’s post I see he covers a few things I forgot.
If you put the 2 together I believe you have a pretty good idea on how foundsets and datasets work