Need to duplicate form data in a loop

Hello all,

As shown in the above screenshot, I need to duplicate the data, for example if 3 clients are needed then we click on ‘Add Client’ 3 times and enter the data. So I am able to simulate the clicks via do while loop and the text if getting filled in the first loop, but the data is not getting entered from the second loop onwards rather it is entering on the existing first fields only.
Is it possible to shift the focus of the ‘type into’ commands into the new fields without creating a new workflow for each separate loop?

Are you looking to essentially make the entire selector dynamic, so that it’s different each iteration through the loop?

Yes I got the whole type into sequence in a loop, there are 7-8 type into’s I guess, the values can get duplicated not a problem, but it does not type into the new fields when I click on add client instead it types on the existing text fields only

Got it. That’s a tricky one to assist without seeing the actual selectors.

You’ll need to compare selectors for each of the identical fields for each client. Hopefully, there’s a selector that tells you whether the “Client Type” field is the 1st, 2nd, or 3rd, etc field. There should be a way to differentiate which Client it should type into, just have to do some digging in UiExplorer.

Are you able to send a link to the website you’re automating?

1 Like

Am afraid I won’t be able to as it’s an internal website which am accessing using vpn.
Yes @Greg_Jacobson I can tell which field it is on by checking my loop index number. So first loop fills the fields alright, from second onwards its the problem. Actually am able to minimise the first loop then proceed towards filling the second, but the type into selector just doesn’t detect those fields at all.

Can you share the selector you’re using? Let’s just look at the Client Type field for our purposes


Screenshot of the selector details of the field client type.

And what’s the selector if you manually indicate the second Client Type field?

I’m wondering if it’ll be:

id='associateClient_1_ddlClientType'

That would allow you to replace the 1 with index variable, and make it work properly.

1 Like

Hey this actually helps! Thanks a bunch! Hey one last help how could I replace the 1 with the index variable? I am able to access my index variable, but how to put it inside that selector attribute?

Great! This will probably be kind of a pain since you have so many type into activities, but you’ll create a string variable called sel or something. If your index variable is named index, then before each type into activity, reassign that variable value to:

sel = "associateClient_" & index & "_ddlClientType"

Then assign the sel variable to the id selector.

You’re going to have to do this before every type into, and figure out what the id looks like for each field, since they all won’t be "ddlClientType"

If you’ve never used a dynamic selector before (used a variable in a selector), refer to this website to help you.

1 Like

Hey thanks a lot @Greg_Jacobson This was super helpful, I will surely try this. Thanks again!

1 Like

You’re welcome!

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