The following code should do the trick: q = new Query(); qbds = q.addDataSource(tablenum(DirPartyTable)); qbr = qbds.addRange(fieldnum(DirPartyTable, recId)); qbr.value(strfmt('("%1" == %2.%3) || ("%1" == %2.%4)', name, qbds.name(), fieldstr(DirPartyTable, firstName), fieldstr(DirPartyTable, lastName))); I just use the DirPartyTable as example. name is the argument that is passed to function.