Alternative multiple items in a task

The issue is displayed right in Modeler! You’re missing a comma. Always good to double check all the field validation in Modeler.

There is one other issue: List is not defined prior to the output, so the append operation is returning null. The easiest fix is to instantiate the variable as a list on your start event:

Once you’ve done that, your model works:

Next I would recommend you look at the documentation previously linked for multi-instance markers to handle the iteration on the third task, and passing in the context from the list. Give it a shot!

I have the documentation, but I don’t find it very conclusive. What I tried to do in the third task is to write as a local variable ‘List1’ and then further ‘=List.’ The problem is that the values from before are not displayed, and if I type something, no further values are shown either. Even if there should be input in the last task, nothing would come. The documentation mentions something about ‘source’ and ‘target.’ I understand what should come, but unfortunately, it’s not explained exactly how it should be. Thank you for your help, and sorry for the interruption.

As I understand it, your goal in the third task is the loop the list of values generated in the second task, and update the values. Updating the values will require a second list, but it will be generated in the exact same way as the second task creates its list. So the only bit you haven’t done yet is taking one item from your first list and passing it to your user task/form.

That is documented on this page. You want to iterate over the list you created in the second task (so your Input collection is =List), and you want pass each item from the list to the user form, which is defined in the Input element field. Whatever name you assign in Input element is the name of the variable containing the current item from the list. That’s what this part of the documentation is describing:

To access the current element of the inputCollection value within the instance, the multi-instance activity can define the inputElement variable (e.g. item ). The element is stored as a local variable of the instance under the given name.

Then your form will need to read the default value of the form elements from inputElement.Name and inputElement.Price (replacing “inputElement” with whatever you choose to name the variable, of course).


Would it be correct what I have solved? Regarding the input element, I am unsure if I have done it correctly, as the documentation does not mention what to do when an item has two values. One question: for the output collection, do I need to enter the same as I did for the input element, and for the output element, the same as I did for the input collection? Thank you.

“Input element” is the name of the variable data from the current iteration is assigned to. List is a list of contexts; each iteration, the current value from List is a context object. So if you put currentItem as the value in “Input element”, and List = [ { Name: "one", Price: 1 }, { Name: "two", Price: 2 } ]

First iteration, currentItem will have the value { Name: "one", Price: 1 }.
Second iteration, currentItem will have the value { Name: "two", Price: 2 }
Each iteration, currentItem is sent to the form with the current value.
Inside your form, the “Default Value” should then be currentItem.Name

image

I have entered currentItem.Name and currentItem.Price in edit items in form, but no values appear; instead, it simply displays “currentItem.Name” and “currentItem.Price.” Now, I understand the difference between “element” and “collection.” I used “List” as the input collection and “currentItem” as the input element. Somehow, I don’t know why values are not appearing in the edit task. One question: at the end of this task, should I create a new additional list under “output”?
Here is the process:
item-new.bpmn (10.7 KB)

Apologies, I accidentally did the wrong thing! For this, you do not need to set the “Default value” in the form, but instead add an input mapping for the form fields.

And yes, you need to handle the output or you will not save any of the updated data from the form. You’ll need to do the same thing that was done in task 2, but with a new variable name. (And you’ll need to instantiate that variable on the start event, etc.)

I have followed your advice and believe I am on the right track. I have created a new list and inserted the items you sent in the picture. I just tested it with play mode, but somehow, values are displayed that I did not write in the task ‘write items.’
item-new.bpmn (11.3 KB)

It seems this might be related to the bug we found earlier. I’m looking into it!

Thank you very much, everything I did with input and output was correct. One question: when will the bug be fixed?

It appears it might only be a bug with Play Mode. I have to do some additional testing to find out.

@anon64962691 we have a “repeatable subform” component on the roadmap for the next 3 months, that will cover exactly this: Adding multiple rows of a set of components with a “add” button

1 Like

Hello, thank you for the information.

Hey I wanted to make this with a checkbox but it says ailed to evaluate expression ‘field_xyz’: no variable found for name ‘field_xyz’. How can i solve this problem.

Can you share your BPMN model? Or some screenshots of the error, the task definition, and the form definition?

1 Like

I have solved the problem. I added a different value to the boolean variable in the output, and then it worked.

1 Like