I have one large list of dictionaries pulled from a database. I'm wondering if there is a way to search the first list of dicts to only show the first 3 digits (list would be unique to avoid duplicate entries) in one dropdown menu and, based on the selection, show the appropriate options?
Essentially the first dropdown would show selectable options "220, 221, 222, 223, 224", let's say we selected "220", then the second dropdown would show '220_2_INTL_PRSTR_ET_619076', '220_4_KAL_T2E_DOLE_344657'. I'm not worried about the code needed to create the dropdowns, just the filtering of the list of dicts to achieve the results.
list_of_dict = [
{'label': '220_2_INTL_PRSTR_ET_619076', 'value': '220_2_INTL_PRSTR_ET_619076'},
{'label': '220_4_KAL_T2E_DOLE_344657', 'value': '220_4_KAL_T2E_DOLE_344657'},
{'label': '221_1_PB_520_REF_174049', 'value': '221_1_PB_520_REF_174049'},
{'label': '222_5_KAL_T2E_YT_344991', 'value': '222_5_KAL_T2E_YT_344991'},
{'label': '223_2_PB_520_REF_174050', 'value': '223_2_PB_520_REF_174050'}, ,
{'label': '224_3_PB_520_REF_174051', 'value': '224_3_PB_520_REF_174051'}]