i want to show "Commodity Code" field dropdown based on the "cost type" field selection

As you can see from the below screenshot ,I have two field with values in sub list, which i have used as dropdown in the main list.
I was able to get the dropdown in the app, I used distinct Value from cost type field and when user selects Cost Type from dropdown I want show values in commodity code dropdown which is based on cost type selection.

If user selects Advertising in cost type dropdown, then first 3 value in community code should show in dropdown i.e. direct to consumer, advertising production, hcp advertising.