Page 1 of 1

merge datasets

PostPosted: Sat Nov 05, 2011 12:27 pm
by Hans Nieuwenhuis
Hi,

Is it possible to merge datasets.
I have datasets from several getDataSetByQuery runs ( can not be done in 1 query )
and I want to merge those datasets to display them in a form.

Regards,

Re: merge datasets

PostPosted: Sat Nov 05, 2011 12:57 pm
by Hans Nieuwenhuis
I found a way to do this by using addRow.

By using
Code: Select all
      for (var j = 1; j <= _dataset.getMaxRowIndex(); j++) {
               _totalDataset.addRow(_dataset.getRowAsArray(j))
      }

Re: merge datasets

PostPosted: Sat Nov 05, 2011 5:46 pm
by ROCLASI
Hi Hans,

To make this more memory efficient I would use the following code:

Code: Select all
for (var j = 1; j <= _dataset.getMaxRowIndex(); j++) {
    _totalDataset.addRow(_dataset.getRowAsArray(1));
    _dataset.removeRow(1);
}


Unless of course you need to keep the original DataSet intact.

Hope this helps.

Re: merge datasets

PostPosted: Sat Nov 05, 2011 5:51 pm
by Hans Nieuwenhuis
Right !, Thanks