Number of records added to dataset after FILL()

Posted by Lieven De Foor on 14-Nov-2018 11:20


Is there a quick way to get the number of records added to a dataset after performing FILL()?

My data source is a query, and I thought of getting NUM-RESULTS after FILL(), but that returns ?, probably because the query is already closed (IS-OPEN returns false).

I could write some routine counting the current number of records and the number after FILL() (FILL-MODE is APPEND), but something built-in, and fast, has my preference off course...

Edit: What I actually need in my specific case is to know if the FILL() operation added any records or not... So perhaps I'm already too much in solution-mode posing the above question...

All Replies

Posted by Peter Judge on 14-Nov-2018 13:52
The number of records in the FILL query is <> the number of records in the temp-table(when there are duplicate key values and FILL-MODE = MERGE).
You can open the FILL query with PRESELECT which will give you the former. I would think (untested) that the dataset or buffers BEFORE-FILL should have the queries open already. You’d have to use the datasource’s QUERY attribute to get that query.
Posted by Lieven De Foor on 14-Nov-2018 14:00

The dataset events were a good hint Peter. For my simple requirement of knowing if any records were added (FILL-MODE = APPEND), I should be able to use a flag in the AFTER-ROW-FILL to know if anything was added...

Posted by Mike Fechner on 14-Nov-2018 14:06

I'd try to avoid AFTER-ROW-FILL. It has negative impact on the performance. I'm, pretty sure that counting records in the TT before and after will be faster - if that's the only option.

Posted by Lieven De Foor on 14-Nov-2018 14:09

Hi Mike,

Yes, I've heard you say that before, but we don't have that experience here (an AFTER-ROW-FILL is already in place, so adding that flag there won't make the difference either).

This thread is closed