Reuse of repeating group connected to PostgreSQL

There is a repeating group using parameterized PostgreSQL query, which is used on multiple placeses with different param values. The idea is a reusable element with this repeatable group, but I’m stuck in passing down the parameters correctly. I created custom state on reusable element, which is only available on the page using it and than during page load event set it the required value, but struggle how to pass it to the repeating group data source parameter. Thank you in advance.