adding document attribute criterion to query buffer

Does anyone have a code sample I could pick apart that adds a criterion to a query buffer to search for a document based on a custom attribute value? I have been using aaApi_SQueryCriDataBufferAddCriterion to set up the buffer and for all the other criteria I added, the search works, but after adding the criterion to check if the document's custom attribute JOB_NO has a certain value, I've gotten no where. There is no error returned in adding the criterion, it's just that aaApi_FindItemsToBuffer won't return any items and it should.

const GUID pset_ATTRIBUTE_GENERIC = PSET_ATTRIBUTE_GENERIC;

HAADMSBUFFER hCritBuf = (VOID *)NULL;

wchar_t jn[8]=_T("12025");

if ((hCritBuf = aaApi_SQueryCriDataBufferAddCriterion(hCritBuf, 1, GT_RESTRICTION | VT_SINGLE_VALUE | UT_REGULAR, &pset_ATTRIBUTE_GENERIC, L"JOB_NO", 0, DMS_RELATION_EQUAL, AADMS_ATTRFORM_DATATYPE_STRING, jn)) == NULL)

MessageBox::Show("Error adding criterion");

else

ok = aaApi_FindItemsToBuffer (&searchContext, hCritBuf, &cancel, &items);

 

Thanks,

Stephanie