Visual Application: Call Python code in JavaScript

sbackmann
sbackmann Registered Posts: 2 ✭✭✭
edited July 16 in Using Dataiku

Hi,

In order to edit a project variable in a visual application, I want to create a search box with auto suggestions. I managed to create Select boxes for variables with this Python Code:

import dataiku

def do(payload, config, plugin_config, inputs):

    countries = dataiku.Dataset("Countries").get_dataframe()

    
    choices = []
    for val in countries['Land'].unique():
        choices.append({"value": val, "label": val})

    return {"choices": choices}

I can also create a search box with suggestions in JavaScript where the possible choices are hardcoded. I struggle however to populate the choices for the suggestions from a dataset, similar to the above Python code. I studied the example here but it doesn't become quite clear to me how to integrate callPythonDo() into the JavaScript code.

Thanks for any help.


Operating system used: MacOS Monterey 12.1

Tagged:
Setup Info
    Tags
      Help me…