How to order a String[] containing numbers in desc way

Hello all,

I’m wondering what is a good methode for ordering a String Array which contains numbers in a descending way. From the Largest to the smallest.

I tryd the .OrderBy methodes and alot of differend onces but i can’t seem to get them working

function_IRgapDelta.xaml (22.9 KB)

You can simply use Sort on Array.

Array.Sort(arr);
// reverse array
Array.Reverse(arr);

Maybe i’m missing how this function works. Cause it gives me an error that this expression doesnt return a value.

Lets say my String is called A (This one is filled with alot of numbers)
To sort i do
Assign:
A = Array.sort(A)

Right? Well this returns a compile error that the expression does not returns a value.

Can u use Invoke code activity. Not the assign activity.

Havent Used the invoke code before as it is forbidden by the company i work for. But i guess this small intervention can’t hurt.

Although when i use the invoke code method it seems to keep giving me an error.

error2

Check this post on how to use “Invoke Method” activity.


2 Likes

Check the workflow for more insight

Flowchart1.xaml (6.7 KB)

2 Likes

Alright i figured out that using a string of arrays corrupts the data as i never know which the total outcome is. Is there a way to do this same method with a List ?

I made everything work but it descend in a way that it doest read the entire string but every char. So for example
if i order 88 9111 and 288 the order will be:

9111

88

288

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