yhPark
March 19, 2020, 2:23am
1
In the beginning,
I want to change the sequence of each element in an array like this:
But, I have no idea how to do, so, I try to make another array like this:
and please also refer to:
Main.xaml (19.2 KB)
But, It didn’t work.
In my opinion, the Str_Array_Test in my workflow must not be changed, but it has been changed.
please someone help me!
Hi @yhPark
You can use Invoke Method activity to achieve your case as below.
Array.ConstrainedCopy(Str_Array_Test.Concat(Str_Array_Test).ToArray, Str_Array_Test.Length - 1, Str_Array_Test, 0, Str_Array_Test.Length)
@yhPark The order that you want the array to appear , Is it in Ascending Order?
Manish540
(Manish Shettigar)
March 19, 2020, 4:29am
4
Check this workflow, @yhPark
Reverse_Array.zip (13.0 KB)
1 Like
yhPark
March 19, 2020, 4:44am
5
No, It is not Ascending. I want to move the last item to the first, and move one space back for the others.
Manish540
(Manish Shettigar)
March 19, 2020, 4:46am
6
Checked with Reverse_Array workflow @yhPark ???..
yhPark
March 19, 2020, 4:52am
8
Thank you, but the result that I want is:
before: 3, 2, 1;
after: 1, 3, 2
Manish540
(Manish Shettigar)
March 19, 2020, 4:56am
9
Whether the values inside the array will be constant, like ‘3’???
yhPark
March 19, 2020, 5:06am
11
No, it is just an example to explain.
All I want is,
move the last item of some array to the first;
move the other items of the array to one space back;
Array before: (1st, 2nd, 3rd, …, last-1, last)
Array after: (last, 1st, 2nd, 3rd, …, last-1)
The Array type is not limited to integer, (string, files, and so on)
yhPark
March 19, 2020, 5:12am
12
Could you please explain more details for define invoke method?
(where can I put the code above to invoke method) Sorry, ioi…
@yhPark Can you Check this workflow :
Main.xaml (17.3 KB)
I guess this is the Output you needed
yhPark
March 19, 2020, 5:36am
15
It works perfectly!!
Thank you very much!!
Madhavi
(K)
March 19, 2020, 5:37am
16
Create new array with same length as the input array.
Move the last item in the input array as first item in new array.
Use Array.Copy method to move all other items starting from index 0 to last but one item to the new array starting from 1st position,
Array.Copy(arIntArray, 0, arIntNewArray, 1, arIntArray.Length -1);
ChangeArraySequence.xaml (7.0 KB)
Hope this helps!
system
(system)
Closed
March 23, 2020, 7:49am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.