[SOLVED] Filter dynamicDataSet by Reference Field

I have the following data set (Produtos)

and this dynamic dataset of the page (Empresas):

I want to filter the data of the second one (Empresas) that has “Produtos” in some selected “Categorias”.

If I select “Papelaria” I want my filter to return “Empresas” of the “Produtos” that has the “Categoria” “Papelaria”.

I’m quite lost in this one, I already can get the “Produtos” that has the selected “Categorias”, but I’m having a hard time trying to return “Empresas” for these “Produtos”

For those wondering how I’ve done that. You can actually filter by reference fields but you have to use the ID of the field and not the value. Igot this done using the ID’s