I think you are looking fore something like this. Here is an example of my page, i am using the URL to get the variables. Then i use them during my fetch.
{% assign type = request.params.type | split: "," %}
{% assign start_date = request.params.start_date %}
{% assign end_date = request.params.end_date %}
{% assign status = request.params.status | split: "," %}
{% fetchxml werkorders %}
<fetch>
<entity name="msdyn_workorder">
<attribute name="msdyn_name" />
<attribute name="createdon" />
<attribute name="msdyn_workordertype" />
<attribute name="msdyn_substatus" />
<attribute name="msdyn_totalamount" />
<attribute name="msdyn_functionallocation" />
<attribute name="msdyn_workorderid" />
<link-entity name="msdyn_workordertype" from="msdyn_workordertypeid" to="msdyn_workordertype" link-type="inner" alias="workorder">
<attribute name="msdyn_name" alias="WorkorderTypeName" />
</link-entity>
<filter type="and">
{% if request.params.type > 0 %}
<filter type="or">
{% for item in type %}
<condition attribute="msdyn_workordertype" operator="eq" value="{{ item }}" />
{% endfor %}
</filter>
{% endif %}
{% if request.params.status > 0 %}
<filter type="or">
{% for item in status %}
<condition attribute="msdyn_substatus" operator="eq" value="{{ item }}" />
{% endfor %}
</filter>
{% endif %}
{% if request.params.start_date > 0 %}
<condition attribute="createdon" operator="on-or-after" value="{{ request.params.start_date }}" />
{% endif %}
{% if request.params.end_date > 0 %}
<condition attribute="createdon" operator="on-or-before" value="{{ request.params.end_date }}" />
{% endif %}
</filter>
</entity>
</fetch>
{% endfetchxml %}
I hope it helps. The above example might be a bit challenging but if you understand how to per example {% assign start_date = request.params.start_date %} then you can use that as a parameter in your fetch. Let me know if you need more help.
Kind regards,
Meton