From your explanation its not clear how you use the filtering condition. Where do you hard code it? Anyways if it works for you if you hardcode the condition somewhere Im pretty confident that it would work also if you would to use some kind of macro (query string or custom one?) depending on your needs. Please refer to the following in order to learn how you could use macros.
In the end you could simply use the macro instead of the hardcoded value.