Passing multiple datasets in columnRole for a custom plugin

Options
lina
lina Registered Posts: 12 ✭✭✭

Hi!

I am creating a plugin and I'm struglling on how to pass multiple datasets into the columnRole parametar in the JSON file. (I have two input datasets and I wanna have the option to select a column from either of the two and not just from one dataset):

"inputRoles" : [{"name": "first_dataset","label": "First Dataset","arity": "UNARY","required": true,"acceptsDataset": true},{"name": "second_dataset","label": "Second Dataset","arity": "UNARY","required": true,"acceptsDataset": true}]

and here is the column:

{"name": "partitioning","label": "unique identifier for a record","description": "","type": "COLUMN","allowedColumnTypes": ["tinyint","smallint","int","bigint","string"],"columnRole": "first_dataset","mandatory": true},

Thanks!!

Answers

  • StanG
    StanG Dataiker, Registered Posts: 52 Dataiker
    Options

    Hi,
    There is no way to pass multiple datasets in the columnRole field of the same parameter.
    Instead, you could for instance create a SELECT parameter to choose from which dataset to select a column from, use 2 different parameters with 2 different columnRole corresponding to the 2 input datasets and display the right parameter in the UI based on the SELECT parameter using a visibilityCondition.

    This would look like this:

            {"name": "selected_dataset","label": "Input dataset to select a column from","type": "SELECT","defaultValue": "first_dataset","selectChoices": [{"value": "first_dataset","label": "First dataset"},{"value": "second_dataset","label": "Second dataset"}]},{"name": "partitioning_first","label": "unique identifier for a record","description": "","type": "COLUMN","columnRole": "first_dataset","visibilityCondition": "model.selected_dataset == 'first_dataset'"},{"name": "partitioning_second","label": "unique identifier for a record","description": "","type": "COLUMN","columnRole": "second_dataset","visibilityCondition": "model.selected_dataset == 'second_dataset'"}

  • lina
    lina Registered Posts: 12 ✭✭✭
    Options

    @StanG
    Thank you so much!

Setup Info
    Tags
      Help me…