Visual Application: Call Python code in JavaScript

sbackmann
Level 1
Visual Application: Call Python code in JavaScript

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

0 Kudos
0 Replies

Labels

?
Labels (2)
A banner prompting to get Dataiku