Question about related foundsets

I have a little question that you gurus might answer or clarify.

I know that Servoy, by default, loads 200 records in a foundset. Does it happen with related foundset as well? I mean if I have a customer table related to a transations table (customers_to_customerrtransactions) when I select a record in the customer table only the first 200 records are loaded?

Even I would like to know this I prefer to explain the reason for the curiosity.

I have a invoice form with its invoice items form in a tabpanel where the user edits the invoice. I have created the calculations and aggregates to have the invoice totals, but it´s only displayed when data is saved on the database. I understand the reason for that, since the aggregate is calculated with a SQL sentence that looks for data in the DB.

Well that´s good, but I have the databaseManager.setAutoSave set to false, since I do not want to save any record in the invoice items table until the invoice is saved. Well, doing that I can not use the calculations to show the totals in the forms, but I can use it in later operations, and so what I do is to use a global function that I have created to sum one or various columns from a foundset (that is because I come from FoxPro and I use the SUM function in cursors to get this done). Doing that, if only 200 records are loaded, I could get wrong data.

What happen if a use loadAllRecords in the related foundset? Will it load all the related records or all the records?

And the most important, is there a way to get this in a better way?

Thanks in advance.

BTW adding functionality to a foundset to get SUM, AVG, COUNT or whatever would be fantastic, don´t you think?

no related foundset are not loaded loaded completely those are also going with blocks.
But how is that going wrong for you? if you loop through the foundset we will load it as you go

You can already just create aggregates for SUM/AVG by using aggregates. But do you mean you want of have functions on the foundset like:

fooundset.SUM(“column”)

?

You are right, looping thru the foundset will load data as I go. Sorry for that.

Yes, what I mean is to have the functions on the foundset and thinking about it could be better to get an array of sums if I send several columns, for example: foundset.SUM(“quantity”,“amount”)

Thanks

jcompagner:
no related foundset are not loaded loaded completely those are also going with blocks.
But how is that going wrong for you? if you loop through the foundset we will load it as you go

You can already just create aggregates for SUM/AVG by using aggregates. But do you mean you want of have functions on the foundset like:

fooundset.SUM(“column”)

?

but what would that really give you compared to:

foundset.quantitySum
foundset.ammountSum

?
then you also have both at once,

Servoy already gets those at once for you from the db.

jcompagner:
but what would that really give you compared to:

foundset.quantitySum
foundset.ammountSum

?
then you also have both at once,

Servoy already gets those at once for you from the db.

Yes but I can not use the aggregate until the data is saved on the DB, isn’t it?

In my invoice form I do not save the items until the user wants to, so I can not use the aggregate field.

That is the reason to miss a SUM function over a cursor in memory.

Thanks.

if you want it in memory then you could do it now your self by a global function:

function sum(foundset,columnname) {
  var count = 0;
  for each record in foundset
    count += record[columname]
  return count;
}

But you have to be very careful with these things, because if the foundset has thousands of records you are loading in quite a lot of data.