1

I have a data set like that:

product_id subfamily family
001 alpha A
002 beta A
034 gamma B
078 gamma B
098 beta A
021 epsilon B

where each row is a product and products are classified in their subfamilies and families. There are just two families, A and B. A has specific subfamilies which cannot be in family B and viceversa. The same happens with the products, the products in one subfamily cannot be in other subfamilies.

The thing is, I wanna have more than one filter, so for example if in the first filter I choose family A and I add a second filter based on subfamily, the options in subfamily will just be "alpha" and "beta", gamma and epsilon shouldn't appear because I would have already filtered by family A.

Is this possible? Right now I can add multiple filters but all the options appear so the user can filter in criteria which are not compatible (for example selecting family A and then selecting subfamily gamma, this shouldn't be possible).

Thanks!

Miquel
  • 442
  • 3
  • 14
  • My answer to [this](https://stackoverflow.com/questions/68584478/how-to-update-shiny-module-with-reactive-dataframe-from-another-module/68594560#68594560) question shows you the technique you need: use `updateSelectinput` inside an `observeEvent` to change the choices available in the sub-family filter whenever the value of the family filter changes. The focus of the question I link to is the use of modules, but the same approach will work here. – Limey Oct 04 '21 at 16:32
  • Perhaps [this](https://stackoverflow.com/questions/65309601/dynamic-filters-shiny-app-with-equal-common-levels) might be useful if you wish to use non-modules approach. – YBS Oct 04 '21 at 17:25
  • thanks, I will take a look in both solutions and will give feedback. – Miquel Oct 08 '21 at 07:24

0 Answers0