BUG: Replaced extendedSQL/buildSQL with DataList as per ticket 8183

BUG: Correcting the4 case of a function

Corrcting the case of a function

BUG: replaced deprecated extendedSQL call with DataList->where