Dependent Column values

decsion
from the Table available the columns Reason code, Staging, Overwrite are dropdowns where you can select from. I am trying to make the values under Final Staging column dependent on the 3 dropdown columns example If i select concession under Reason code, Stage 1 under Staging and Yes under Overwrite the cell on that row under Final Staging should be automatically populated with Stage …Anyone come across this and how did you fix it.

Hi @dankie welcome to the forum! You can write a callback listening to the data property of your table, and populate the final staging column depending on the values of the other columns. Changing one value in the dropdowns will change the data property, and the callback will be called.

Okay i will try that and give you feedback

so i tried but it seems not to work, below is my code and error message

app.layout = html.Div([
    dash_table.DataTable(
        id='table-dropdown',
        data=staging.to_dict('records'),
        columns=[
            {'id': 'customer_id', 'name': 'Customer ID'},
            {'id': 'booking_date', 'name': 'Booking Date'},
            {'id': 'oustanding_balance_(currency)',
             'name': 'Outstanding Balance(currency)'},
            {'id': 'booking_date', 'name': 'Booking Date'},
            {'id': 'past_due_days', 'name': 'Past Due Days'},
            {'id': 'segment', 'name': 'Segment'},
            {'id': 'contract_rate_%', 'name': 'Contract Rate(%)'},
            {'id': 'fee/commission_rate_%', 'name': 'Fee/Commission Rate(%)'},
            {'id': 'collateral_(force_sale_value_(currency)',
             'name': 'Collateral(currency)'},
            {'id': 'collateral_(type)', 'name': 'Collateral(Type)'},
            {'id': 'maturity_date', 'name': 'Maturity Date'},
            {'id': 'repayment_years', 'name': 'Repayment(Years)'},
            {'id': 'quantitative_assessment', 'name': 'Quantitative Assessment'},
            {'id': 'reason_code',
                'name': 'Reason Code', 'presentation': 'dropdown'},
            {'id': 'staging',
                'name': 'Staging', 'presentation': 'dropdown'},
            {'id': 'overwrite',
                'name': 'Overwrite', 'presentation': 'dropdown'},
            {'id': 'final_staging', 'name': 'Final Staging'},
        ],

        editable=True,
        dropdown={
            'reason_code': {
                'options': [
                    {'label': i, 'value': i}
                    for i in staging['reason_code'].unique()
                ]
            },
            'staging': {
                'options': [
                    {'label': s, 'value': s}
                    for s in staging['staging'].unique()
                ]
            },
            'overwrite': {
                'options': [
                    {'label': o, 'value': o}
                    for o in staging['overwrite'].unique()
                ]
            }
        }
    ),
    html.Div(id='table-dropdown-container')
])


@app.callback(
    Output(component_id='final_staging', component_property='children'),
    [Input(component_id='quantitative_assessment', component_property='value'),
    Input(component_id='reason_code', component_property='value'),
    Input(component_id='staging', component_property='value'),
    Input(component_id='overwrite', component_property='value')]
)
def update_output_div(quantitative_assessment, reason_code, staging, overwrite):
    if quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 1' and overwrite == 'Yes':
        return 'Stage 1'
    elif quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 1' and overwrite == 'No':
        return 'Stage 1'
    elif quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 2' and overwrite == 'Yes':
        return 'Stage 2'
    elif quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 2' and overwrite == 'No':
        return 'Stage 1'
    elif quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 3' and overwrite == 'Yes':
        return 'Stage 3'
    elif quantitative_assessment == 'Stage 1' and reason_code == 'Breach of contract' and staging == 'Stage 3' and overwrite == 'No':
        return 'Stage 1'
    else:
        return 'No decision'

Here is the error message Output and Input id defined in callback is not found in layout

ID not found in layout
Attempting to connect a callback Input item to component:
  "overwrite"
but no components with that id exist in the layout.

If you are assigning callbacks to components that are
generated by other callbacks (and therefore not in the
initial layout), you can suppress this exception by setting
`suppress_callback_exceptions=True`.
This ID was used in the callback(s) for Output(s):
  final_staging.children