Fixes issue #2373

Use field if supplied, otherwise fall back to attribute (fixes issue #2373)
To ensure that everything is correct you should probably call queryinterface.showIndex(tablename) and ensure that the correct fields are used :)