How to use recursive

Any one who knows how to use recursive method?

make a xaml for that method and pass the arguments for that method.
you can then call that xaml recursively similar to the method that you wanted to call.

could you kindly give me an example ?

Run the recursion.xaml
Recursion.zip (3.6 KB)

1 Like

Hello.

Although you can do recursion in UiPath Studio I don’t really recommend it. I don’t think I encountered a situation in which you need to use recursion in UiPath Studio and it can cause problems with Memory.

3 Likes

Hello Cosmin, how can we do recursive in uipath studio?

For example I want to enter in a function “ABC” and obtain a result (array of string) with all the permutation:

in string : “ABC”
out string : “ABC, ACB, BAC, BCA, CAB, CBA”

of course i want the in string to be dynamic so it will bring me all the permutations of that letters in the given word.

Thanks and regards,
Bogdan

Refer this link

https://www.codeproject.com/Articles/37215/Permutations-in-C-Using-Recursion

Try this way

static char[] numbers = {'0','1','2','3','4','5','6','7','8','9'}
static bool continuar = true
private static void Start(int maxLength)
    {
        for (int i = 0; i <= maxLength; i++)
            Permutations(i, 0, "");
    }

private static void Permutations(int keyLength, int position, string baseString)
{
    bool print = true;
    if (continuar)
    {
        for (int i = 0; i < numbers .Length; i++)
        {
            string temp = baseString + numbers [i];
            if (position <= keyLength - 1)
            {
                Permutations(keyLength, position + 1, temp);
                print = false;
            }
            if (continuar && print)
                Console.WriteLine(temp);
        }
    }
}

Regards,
Arivu

1 Like

Thanks Arivu, but i need a solution uipath, not in Visual Studio nor in C#.

I thought about invoke code activity, but i can not call a function inside it (call a function inside a function).

Regards, Bogdan.

Hello. You can use Invoke Workflow and inside use again Invoke workflow.

Thanks Cosmin.
Have a nice day!

WHat if you want to create a workflow to read Json Properties but a property value can in turn be a json object or json array ? In that case you’ll need a recurse workflow.

Dear all,

I would like to calculate the Recursion Depth level (level 0, level 1 etc.). Do you know how to do it?

Thanks
Gennaro

I want to read all filenames in a particular folder and if the folder contains another folder, it should read that folder’s files too.
So in this case, I think, we will need recursion concept.

Yep I am working on a case like this right now. Have a page with a table of hyperlinks. Each hyperlink leads to another page having another table of hyperlinks, which are either a page I must interact with, or a parent page containing a table of hyperlinks leading to another level deeper, and so on.

Essentially web pages with “folder” hyperlinks. Need to ensure the robot works as deep as necessary into each link on the topmost page.

Hi @bogumil_86,

If your problem got solved? If yes then how because i have the same query as i want to implement function inside the the function.

Regards,
Hemal

Hi @bogumil_86,

I have done component in uipath for your query.Please refer the below link.


Kindly Provide your feedback!!

Thanks
Sharmila