Get Saved Search or How to use Find_Document to get checkout documents

Hi,

I am working on getting the saved search result.

Through forum got to know I cannot get the result of the saved query, I have to use the aaApi_Find_item..or aaApi_FindDocument  methods.

So I tried using aaApli_FindItem but cannot make it work for the criteria

I have 2 criteria

1. checkout document

2. checkout for more than a day.

Following is the code I am using

INT groupId = 123;
criteria = aaApi_SQueryCriDataBufferAddCriterion
(criteria, groupId,
GT_RESTRICTION | VT_SINGLE_VALUE | UT_REGULAR,
&psetDocumentGeneric, L"", QRY_DOC_PROP_DMSSTATUS,
DMS_RELATION_EQUAL, AADMS_ATTRFORM_DATATYPE_STRING,
L"Checked Out");

criteria = aaApi_SQueryCriDataBufferAddCriterion
(criteria, groupId,
GT_RESTRICTION | VT_SINGLE_VALUE | UT_REGULAR,
&psetDocumentGeneric, L"", QRY_DOC_PROP_CHECKOUT_COUTTIME,
DMS_RELATION_GREATERTHAN, AADMS_ATTRFORM_DATATYPE_DATE_TO_DAY,
L"1");

With only first criteria , it works but the documents retried are more than 5000 , which is not true. If I give second criteria the FindItem method return False.

I have tried using FindDocument but could not figure out the parameters to pass 

LPCRESULTCOLUMNS lpResultColumns=NULL;(how to define this columns)
LPCFINDDOC_RESULT reactor;
BOOL bResult = aaApi_FindDocuments(hBuffer(got from the aaApi_SQueryDataBufferSelectAll), lpResultColumns, FindDocumentCallback, &reactor,false,0,0);

Any help is appreciated. Thank you.

Regards,

Rashmi.