How to Filter lists base on document workflow state?

How to Filter lists based on document workflow state?
I have a doctype order, and I created a workflow for it. Now I want to show only some orders at a specific workflow state. How can I do that?

Is there any document about working with workflows in client and server scripts?

Have you tried using the standard filters?

Or if you are looking to control from the server side, have a look at the following:
Modify List Query (