Hi gproData,
Where did you get the idea that loops take a lot of time?
If you see some short code, then it often done behind the scene as well in a
loop.
But you can of course use Linq to Dataset, but don't assume it goes quicker.
(At least it uses some more code)
http://msdn.microsoft.com/en-us/vbasic/bb688086.aspx
Success
Cor
"prodata" <(E-Mail Removed)> wrote in message
news:418fa776-d981-414d-b457-(E-Mail Removed)...
> I've got a large set of time-series data which is organised _strictly_
> in time sequence and contained in a (VB2005) datatable.
>
> I want to iterate through this data to extract various hourly means,
> which means identifying blocks of consecutive rows and computing
> hourly aggregate functions (mean, SD etc).
>
> I do have this working but by progressively working through the table
> from top to bottom, identifying a block of rows with the same hour
> value, copying this block of rows to a separate scratchpad datatable
> and using various datatable.compute aggregate functions on all of the
> rows in the scratchpad table.
>
> I'm sure this isn't the most efficient approach in that it would be
> better to work on the full original datatable and to pass a filter
> expression to the datatable.compute command to indicate which
> particular block of row numbers should be used in the calculation, but
> being only an occasional ADO.Net user I don't know how to build the
> filter.
>
> What I want to say for the filter argument is something like 'Where
> Rownumber Between R1 And R2" or 'Rownumber >=R1 AND Rownumber <=R2".
> (I will know which row numbers constitute the relevant block and I
> don't want to filter by datetime value - each hourly block would be
> little more than 0.01% of an annual datatable, so not efficient to
> repeatedly test the whole datatable just to select a particular hour's
> worth of data.)
>
> So I guess the question is whether there is any way of accessing the
> row number property from a filter expression. (I guess I could
> manually build in a row number column into the table and filter on
> that, but maybe this is unnecesssary.)
>
> Anyone able to help please?