I have fixed the problem. This appears to have been due to inconsistent references to an imported table. The table appeared twice in the relationships diagram but only once in the menus for selecting fields. Renaming and relinking the table solved this problem. It is interesting, though that filtering worked for numeric fields whether or not a constant number or field reference was used as a filter in the position function. For text fields only a text constant worked.