I am trying to sort a foundset before it gets sent to Jasper Reports for viewing.
However, after sometime the following error was prompted in the display:
“Couldn’t do a sort because there where edited records on this foundset”
So what I did was I tried creating a duplicated copy of the foundset through the codes below so that I would not mess with the original foundset:
copyOfFoundset = foundset.unrelate();
copyOfFoundset.sort(“columns asc”);
But it does not create another foundset, it only creates a reference to the original one.
How do I create another copy of foundset so that when I sort the foundset it would not have the error above?
ngervasi:
You will have to call saveData() anyway before being able to sort, the data change is independent of the foundset.
thats not true (anymore)
a foundset only can’t be sorted if his own records are editing (or it has new records, also new records copied from a duplicateFoundset call)
but if you have a changed records and you make a copy through duplicate, then the changed record is only referenced in the original not in the duplicated.
ngervasi:
You will have to call saveData() anyway before being able to sort, the data change is independent of the foundset.
thats not true (anymore)
a foundset only can’t be sorted if his own records are editing (or it has new records, also new records copied from a duplicateFoundset call)
but if you have a changed records and you make a copy through duplicate, then the changed record is only referenced in the original not in the duplicated.
i think this should already work in the 4.x
it could be that we had a bit more restricted behavior before.
for example databaseManager.getFoundset() also always can be used to search and sort, even if you have another foundset that has edited records (on the same table)
jcompagner:
i think this should already work in the 4.x
it could be that we had a bit more restricted behavior before.
for example databaseManager.getFoundset() also always can be used to search and sort, even if you have another foundset that has edited records (on the same table)
databaseManager.getFoundset() works fine as you say, I’m not sure about duplicate() in 4.x.
Good to know anyway.