Function fSeekpair > >** determine if cPerson_id has bought all the items in ItemsArray >** Purchase table has an index on cPerson_id+cItem_id. ItemsArray is an array of cItem_id > >Parameters cPerson_id, ItemsArray, nArraySize > >Local nCnt, lPairFound > >nCnt = 1 >lPairFound = .T. > >Do While nCnt <= nArraysize.AND.lPairFound > lPairFound=Seek(cPerson_id+aItemsArray[li,1],'PURCHASE','Person_Item') .AND. lPairFound > li=li+1 >EndDo > >Return lPairFound
Function fSeekpair ** determine if cPerson_id has bought all the items in ItemsArray ** Purchase table has an index on cPerson_id+cItem_id. ItemsArray is an array of cItem_id Parameters cPerson_id, ItemsArray Local lnCnt, llPairFound, lnArraySize lnArraySize=alen(ItemsArray,1) && assuming two-dimensional array (code, description) llPairFound = .T. for lnCnt=1 to lnArraySize llPairFound=Seek(cPerson_id+aItemsArray[lnCnt,1],'PURCHASE','Person_Item') if not llPairFound && Person hasn't bought this item exit && stop at this point endif endfor Return lPairFound>To get all people who bought the n items in aItemsArray
Select cPerson_id from PERSONS where fseekpair(cPerson_id,@Itemlist,Itemlistnumber) ; > into cursor something