Problem when filtering a HubDB query with a custom module field
SOLVE
In my case, the table_id is always the same.
I can imagine different ways you can make it dynamic. If the change occurs in the page level, you can create a property on a Custom Module that allows you to set the related table_id for each page.
If you need to be dynamic within the page, you will have to put a Hubl variable with all the tables ids available and make your algorithm from there.
But in that case, you have to be more carefull since you'll have to go throught authentication, so you probably don't wan't to expose that to the general public.