Hi Nerissa,
if you would want to implement this the absolutely cleanest way I would suggest this:
- Add a GetReccount method to the Data Access class (cDataAccessBase) and put the the following code in:
LOCAL lnRecCount, loSelect
loSelect = CREATEOBJECT("cSelect", THIS.GetAlias())
COUNT FOR NOT DELETED() TO lnRecCount
RETURN lnRecCount
- Add a GetReccount method to your subclass of kbizobj and put the the following code in:
LOCAL loDA, lnRecCount
lnRecCount = 0
loDA = THIS.GetDataAccessObject()
IF TYPE("loDA.Name") == "C"
lnRecCount = loDA.GetRecCount()
ENDIF
RETURN lnRecCount
oBiz.GetRecCount() will always return the number of not deleted records in the BizObj's main cursor object. You might also want to extend the BizObj method, so that it accepts an alias and is then able to return the count of other cursors opened by the BizObj.
Please note, that all the code above is not tested and typed in here directly. So it might not work immediately, but I think it should :)
If you want to keep it more simple you can use this code anywhere in your application:
LOCAL loSelect, lnRecCount
loSelect = CREATEOBJECT("cSelect", Biz.GetAlias())
COUNT FOR NOT DELETED() TO lnRecCount
loSelect = .NULL.
HTH,
Armin
>Is it possible to determine the number of returned records after a biz object requery? I know that I can use reccount() but I don't know where to put it. My current code below doesn't work. I'm wondering if I have to override the method to insert the reccount() inside the requery() method of the business object.
>
>This code is in the Click() method of my command button.
>
>IF Biz.Requery() = REQUERY_SUCCESS
> lnMetaCount = IIF(RECCOUNT() > 1, FILE_BOF, ;
> IIF(RECCOUNT() = 0, FILE_NORECORDS, FILE_ONERECORD))
>ELSE
> lnMetaCount=FILE_NORECORDS
>ENDIF
>
>Thanks a lot for all the help.
>
>Nerissa