Cannot render array value in form

I am using the Hugging Face Inference API connector and the result expression is defined like this:

{
  mapped_result: response.body.translation_text
}

So I have a process-wide variable called mapped_result. Then I have a user task and I have defined an input for it. Its local name is returned_value and it points to mapped_result. But when I set the key of a text field component in form to returned_value, it is shown empty in the Tasklist.

In Operate, I can see that returned_value is constructed like this:

returned_value
["Er ist der Mann."]

So the value is an array. But I can’t render it in the form. And when I use indices, it won’t work. I have already used this:

{
  mapped_result: response.body.translation_text[0]
}

It doesn’t work. Any ideas?

Hi @okaeiz,

Thank you for your request.
The issue seems to be that you’re accessing the first item in the array using the 0 index.
In FEEL, the list’s elements index starts at 1. Here’s the reference to the documentation: List expressions | Camunda 8 Docs

If you access the value via the 1 index, it should work:

{
mapped_result: response.body.translation_text[1]
}

Let me know if you have any issues!

Best regards,
Volodymyr

4 Likes

Thank you @Volodymyr_Melnyk . Also, I came up with this solution:

{
  mapped_result: string join(response.body.generated_text, ", ")
}

And it worked.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.