Count rowns Table.Select


VIP Member
if you are using NER, which it sounds like you are, you'll have to loop through them all and create a counter. If you are in C BSFN you can you aggregate select from the jde c api


Legendary Poster
You could create an exact copy of your table in E1 and then drop it on the database and recreate as dummy SQL view using select (SUM) or select (count)

Or do the hard way above


VIP Member
I've tried to find it, but many years ago I created an application that used a standard function and it gave me the count of records in any file. I've never had the time to, but I'm sure someone could combine it with the Set Selection apis to create a business function to do what FatehCh want to accomplish. If I find my app, I'll post it, but don't hold your breath.

Ben again,


VIP Member
I've used the following technique in the past. It does require that your ER table IO uses a table handle, but it's a slick reusable way of getting the record count for an ER .Select.

First thing you need is a c-bsfn, which is reusable for any such subsequent need(s):

GENLNG idTableHandle;
MATH01 mnRecordCount;

The c-code:
HREQUEST  [COLOR=#333333]hRequest[/COLOR] = NULL;
long lRecordCount = 0;
FILEIO_HANDLE_INFO dsHandleInfo = {0};

[COLOR=#333333]// get HREQUEST for given table handle[/COLOR]
[COLOR=#333333]RTK_CER_FIOGetHandleInfo( lpDS->idTableHandle , &dsHandleInfo );[/COLOR]
[COLOR=#333333]hRequest = dsHandleInfo.hReqest;

// get record count for current selection
lRecordCount = JDB_SelectKeyedGetCount(hRequest, (ID) 0, NULL, 0);

LongToMathNumeric( lRecordCount, &lpDS->mnRecordCount);[/COLOR]

Note that performing the JDB_SelectKeyedGetCount will invalidate the .Select in your ER ( I think?... you may have to re-execute it if you need to read its records ).

And, again, you need to create or use an existing table handle for your ER table io.

After executing the .Select in your ER, call this new bsfn and you should have your record count.