Creating some Server Extension Modules: cannot seem to get data picker to work

Hi all, for those that have created Server Extension Modules, I was hoping for a little guidance here.

This is the HJSON file for a json to plain text module (for LLM’s). What am I missing? I have dataPickObject: true, which as I understand it is all I need to do to allow the UI to pick data from previous steps, but I may be missing something.

[
  {
    type: 'jsonToText',
    module: 'JsonToText',
    action: 'jsonToText',
    groupTitle: 'JSON to Text',
    groupIcon: 'fal fa-lg fal fa-code comp-data',
    title: 'JSON to Text @@var(name)@@',
    icon: 'fal fa-lg fa-code comp-data',
    dataPickObject: true,
    properties: [
      {
        group: 'JSON to Text options',
        variables: [
          { name: 'name', optionName: 'name', title: 'Name', type: 'text', required: true, defaultValue: '', help: 'This will be the name for the output key and the tag used in the expression builder'},
          { name: 'data', optionName: 'data', title: 'JSON Data', type: 'textarea', required: true, defaultValue: '', help: 'Enter the JSON data that you want to convert to plain text.'}
        ]
      }
    ]
  }
]

dataPickObject indicates that the steps after the extension step will be able to select value from this extension step itself.
You need to use this with the dataScheme property for it to work correctly.

I assume you need the JSON Data input field to be bound using a picker, to select values from previous steps. For this, you need to add the attribute serverDataBindings: true. This will render the bolt icon on this field.

2 Likes

Amazing. Thank you @sid for your help, I’ll implement this tomorrow.

@sid this is my updated JSON based on your recommendation. Unfortunately I still don’t have the option to pick data from a previous step, see image below code. Note I have restarted Wappler multiple times as I know sometimes it needs this to update the UI. Any ideas on where I’m going wrong here?

[
  {
    type: 'jsonToText',
    module: 'JsonToText',
    action: 'jsonToText',
    groupTitle: 'JSON to Text',
    groupIcon: 'fal fa-lg fal fa-code comp-data',
    title: 'JSON to Text @@var(name)@@',
    icon: 'fal fa-lg fa-code comp-data',
    dataPickObject: true,
    serverDataBindings: true,
    outputType: "text",
    dataScheme: [
    {
      name: 'response',
      title: 'Data',
      type: 'text'
    }
  ],
    properties: [
      {
        group: 'JSON to Text options',
        variables: [
          { name: 'name', optionName: 'name', title: 'Name', type: 'text', required: true, defaultValue: '', help: 'This will be the name for the output key and the tag used in the expression builder'},
          { name: 'data', optionName: 'data', title: 'JSON Data', type: 'textarea', required: true, defaultValue: '', help: 'Enter the JSON data that you want to convert to plain text.'}
        ]
      }
    ]
  }
]

Screenshot 2023-06-09 at 10.34.16 am

Solved it - I put the serverDataBindings: true in the wrong location, it needs to go within properties.

Thanks for your help Sid.

1 Like