If I use a reduction script generated by REDUCE() and then use the extended RBASIC SELECT…BY syntax, how do I determine the number of records returned in my cursor?
Is this information returned in @REC.COUNT?
TIA,
Matt Sorrell
I believe @reccount only returns a list count on a fully resolved select in cursor 0. There used to be a GET.RECCOUNT() function/subroutine or something like that for non-resolved/latent selects. It's been 7 or 8 years since I messed around with this stuff but the 2.0x docs covered this stuff rather well. Too bad someone swiped my 2.0x manuals.
Warren,
I use GET.RECCOUNT all the time when I'm doing an an RBASIC select on a whole table. Guess I get to dig out the docs and figure out all the other params this function takes.
Thanks,
Matt
Warren,
Actually, it turns out the GET.RECCOUNT will only return the row count for the entire table. It doesn't appear that you can pass a cursor to it, only a file handle.
Thanks anyway,
Matt
If I understand the question correctly, you can't get at the number, because it is undetermined until the cursor is exhausted.
Well, @cursors(x,1) is supposed to contain a @fm delimited list of the keys but it never seemed to work in 2.x. Maybe in 3.x. You could always count the @fm marks. Question is what happens at the 64K size boundary?
As long a you fully resolve the cursor (the BY clause in the SELECT statement must have a sort criteria) @reccount will work:
rs=WITH {TYPE} EQ 'RBASIC'"
fn=VOC"
sl=@ID"
cv=3
mode=0
call reduce(rs,sl,mode,fn,cv,flag)
select fn by sl using cv else stop 'no good'
call msg("reccount: ":quote(@reccount),
,
,) cnt=0 loop readnext @id using cv by at else goto fin cnt += 1 repeat fin: call msg("readnext count: ":quote(cnt),
,,
)