In the Communication it is working also fine. I can access both values with:
{{parameters.table.id}}
{{parameters.table.name}}
Now here comes the problem:
Every time I reopen the module, the select value is blank.
I can still execute the module and the value is still working, but for the user this is quite confusing.
To summarize:
returning an object instead of a string with an rpc to populate a select option is working except that the selected value is not shown after a re-opening of the module.
Does anybody has a solution for this problem?
Best regards
Christoph
I tried a lot of things but in the end, I don’t find an easy solution.
The only way to solve this, looks like I pass a string that I can split into an array.
The rpc will look like this:
"output": {
"value": "VALUE A___VALUE B",
"label": "my label"
}
In Communication I experimented with calls like this but I couldn’t get the value after splitting it into an array.
"{{split(parameters.table;'__')[1]}}"
Therefore I wrote a short IML function:
// get a value from an array-string (a array-string is a string, that looks like an array)
// this is necessary because rpc can only pass one value and not an object.
// therefore I pass multiple values in one string separated with __
function getAS(input, position, separator = "__") {
if ( typeof(input) === "string" && input.includes(separator)){
const array = input.split(separator);
return array[position];
}
return input
}
Still, I observed that it is also necessary to set the input select field to editable: false.
Otherwise, the users could activate Map and enter the label instead of the value manually. But this would lead to errors with the execution.
My input field looks like this:
{
"name": "table",
"label": "Table Name (Source)",
"type": "select",
"required": true,
"mode": "edit",
"editable": false, // important because it requires array-like string from rpc.
"help": "**Hint:** mapping is not available for this selection in this module.",
....
Nevertheless, I am satisfied with this solution because the users don’t see the complexity and the selection is not empty anymore after re-opening.
I have to say that I’m truly impressed with the great work you’ve done on your app. It is so inspiring to see you figuring out solutions!
Thank you very much for leading us through the process and sharing the important details. We really appreciate it, because this way we keep our community tidy and healthy.