Hi all, How would you handle a dynamique button list where you want to display a label but you want the id associated to the label to be set in a variable? I have implemented an API that returns an array of tuples of the id and the label such as [["0","zero"],["1","one"]]. i want the buttons to display "zero" and "one" but the selected value should be "0" or "1".
I would like to bind the dynamic buttons to data.workspaces, display workspaces[x][1] but store workspaces[x][0] in a variable in order to make another call using the selected 'id'.
The only way to have access to the array and bind it to buttons is apparently to returns an array of strings. Is this correct? I will stringify the objects and parse them in a script block then... I would have never guessed that something as common to to have key/value binded to a dynamic list of buttons be so complex to do 😦
I also have this need. It's a very useful basic improvement for those who work with arrays of variable values. @Alex From what I understand, you would have to pollute the text of the buttons with the embedded index, and then use a script to extract it, right?
I'm trying to do this now, in the simplest way possible, maybe with an inline script {{={{My variable}}=str.match(/^\d+/)=}} or a regex ^\d+(?=.) to extract, but I still haven't managed to do it without using the script block. Have you managed to do this without a script?