Create Form in a For Each activity - Problems

Hello Every

I created a form in Uipath Form Designer.

However, this form is in a For Each activity and it has to be opened for each item in a list, but when it goes to the next item, the complete sequence stops.

Is it a bug or anything else ?

I tried everything I know but it doesn’t change.

Could you please help me to repare it ?

Thank you in advance.

L V

1 Like

Hey @ludovic.vetter, Welcome back

Kindly share you xaml for resolution :+1:

Awaiting your response, Thanks :slight_smile:

Hello @Nithinkrishna,

Unfortunately it contains confidential information and a xml file is deserialized in another sequence and used in the For Each sequence.

Though I can explain what the process does :

  • A For Each activity reads the deserialized xml file nodes and check if a tag contains a certain value

  • Into the for each activity there is a Create Form activity. This form contains two textboxes, which have to be completed by the user. When the first form is submitted (it has more than one tag concerned), the execution of my project stops completely.

I hope my explanation is clear (I am non-english speaking).

Thank you :slight_smile:

1 Like

Hi,

Keep a message box and check the for each is happening properly or not. you can Comment Out the form and check for each activity is looping fine or not.

Regards
Roshan

NB: Mark as solution if found useful :slight_smile:

@ludovic.vetter, Thanks for your response.

Yep I got an idea now.

But do you get any specific error.

If not, Have you enclosed your block in try catch.

Thanks :slight_smile:

Hello,

I tried it but I don’t have any errors, it does loop fine.

Regards.

L.V.

You’re welcome :slight_smile:

I tried the Try Catch but no errors happened.

I really don’t get it :laughing:

1 Like

No no @ludovic.vetter

I just asked like are you using try catch.

Kindly check how many items you get in your collection which you are passing in foreach, before it.

Add a log printing count of the items so that it will help to debug.

Meanwhile, im trying a sample workflow.

Thanks :slight_smile:

I think this is not a bug, it is just the way how your form is created and handled during the runtime. Probably we can think about it as if the first time Create From activity executed the form engine is created and the form is shown to the user and after user clicks submit the form is not really closed but just set to hidden, and if the code reaches and executes the Create From activity second time it does nothing because the form is still in the memory in the hidden state.
Userforms in VBA behave in the close to same manner.

Possible workaround is to treat our Create From activity itself as a loop. We need to have a logic to iterate the list with a counter and in the form we should have the elements that are displayed when there are still items in the list, and the elements that are displayed when after the last item in the array is reached.

Check the following workflow for possible solution:
CreateFormLoop.xaml (13.5 KB)

1 Like

Hello,

Thank you for your answer.

I tried to open your xaml file but it says that this activity (UnresolvedActivity) is missing. Which package is it ?

Thank you in advance.

L V

Okay, but how do you add a log printing count ? :smile:

1 Like

I think it is UiPath.Form.Activites :slight_smile:
Or just add the workflow file into your existing project folder.

Okay I will try and come back after

see you later

collectionList.count.tostring

@andrey.egorov Nice workaround.

You can try this approach as well @ludovic.vetter

1 Like

Okay I tried it, but I have one question :

There are values I want to show in the form (from the node), so if I do that way this won’t change for the next form right ?

To answer to @Nithinkrishna, I have 5 to 6 items (depends on the xml file it deserializes).
For each of these items I need to collect the values that I enter in the textboxes.

I hope it’s precise and clear :laughing:

I think about using a workaround with another type of forms than UiPath Form Designer.

Is Syforms easy to use ? Or maybe I could use a Custom Input ?

@ludovic.vetter Can you provide Screenshots of the Form or of the Workflow built, so that we can get a better understanding of the flow ? The Logic Seems to be possible with UiPath Forms :thinking:

image

Sorry it is in French :sweat_smile:

The “texte à afficher” has to change according to a value in the current node.

The process stops when I submit the form (“Soumettre”)

@ludovic.vetter I was surprised to also witness the behaviour of forms in that way :sweat_smile: though I had remembered I had done something similar to it in the past. But there I had made use of RE Framework to iterate over the data and present it in the loop. Similar to that I do not know actually why the Forms behave in that way, Maybe as @andrey.egorov mentioned it does go hidden for the remaining iterations. It is really surprising though :thinking:

Although I had made a workaround as well using a Separate Workflow for the Form Activity. An Example Workflow is given below:

Form Activity.zip (5.3 KB)

Let me know if it doesn’t work.

1 Like

Okay it seems to work fine with the form using a separate workflow, it’s very weird :smile:

I passed all the day on that so I’m happy :grinning:

Thank you a lot guys.

L V