How to use recursive

studio

#1

Any one who knows how to use recursive method?


Uipath recursive
#2

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.


#3

could you kindly give me an example ?


#4

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


#5

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.


#6

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


#7

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


#8

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.


#9

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


#10

Thanks Cosmin.
Have a nice day!


#11

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.


#12

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


#13

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.