Dynamically filter records in Module's Detail view page

How can I change a module’s query for the detail view screen? Currently I have a module with Create/View/Import pages and in view page all the records from the database are shown, but I want to change the query in such a manner that I can dynamically add where clauses from UI and filter records?