added the query at sample level based on fields. 

It is very limited on purpose, I'll open more functions if they are needed.
typo in --> is