Dash Web App callback issue

Jake_Hooley123
Jake_Hooley123 Registered Posts: 1 ✭✭

I am currently building a web app that is using Dash to allow users to input data and store into tables. The app works but when I add in a call back for a specific use case the web app just shows a blank page, no errors or logs are outputted the page is just white.

The purpose of the two callbacks is to populate one another if one field is filled out. For example, I have a supplier name drop down and a supplier ID drop down. I want it so when a user fills out either of these, the corresponding ID or Supplier Name is automatically filled out.

Both supplier names and ID's are stored in the same data table stored on the flow.

The following code snippets:

Drop downs:

html.Div([
html.Div(className="Supplier", children=[
html.Label(['Supplier'], style={'font-weight': 'bold', "text-align": "center"}),
dcc.Dropdown(
id='dropdown-supplier',
options= get_Supplier_names(),
value='N/A',
searchable=True,
clearable=False,
)
], style = {'width' : '50%', 'display': 'inline-block'}),

   html.Div(className="eProc-ID", children=[
html.Label(['eProc ID'], style={'font-weight': 'bold', "text-align": "center"}),
dcc.Dropdown(
id='dropdown-eproc_id',
options= get_eproc_id(),
value='N/A',
searchable=True,
clearable=False,
)
], style = {'width' : '50%', 'display': 'inline-block'}),


]),

Data table functions:

def get_Supplier_names():
"""
return the IVALUA names
"""
df = get_data_from_dataset('eproc_sup_master')
return [option for option in df['Supplier']]

def get_eproc_id():
"""
return the IVALUA sup code s
"""
df = get_data_from_dataset('eproc_sup_master')
return [option for option in df['eProc ID']]

Call backs

@
Output('dropdown-eproc_id', 'value'),
Input('dropdown-supplier', 'value')
)
def populate_eproc_field(sup_name):

if sup_name:
df = get_data_from_dataset('eproc_sup_master')
sub = df.loc[df['Supplier'] == sup_name ]

eproc_id = sub[0]['eProc ID']

return eproc_id

else:
return dash.no_update

@
Output('dropdown-supplier', 'value'),
Input('dropdown-eproc_id', 'value')
)
def populate_eproc_field(eproc_id):

if sup_name:
df = get_data_from_dataset('eproc_sup_master')
sub = df.loc[df['eProc ID'] == eproc_id]

supplier = sub[0]['Supplier']

return supplier

else:
return dash.no_update

When I remove the callbacks the dash app shows correctly and the drop downs work individually but without the ability to automatically fill out each other based on each input.

I have no way of debugging when there is no log errors and a blank page is just shown?

Operating system used: Windows

Answers

  • Grixis
    Grixis PartnerApplicant, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 75 ✭✭✭✭✭

    Hello,

    Could you confirm that when you go through the ‘logs’ section (header top left) you also only get a blank page?

Setup Info
    Tags
      Help me…