i am trying to find min and max value from that array and this is example from uipath academy course.i made it similar to that project but still its not showing proper value.
Main.xaml (10.7 KB)
i am trying to find min and max value from that array and this is example from uipath academy course.i made it similar to that project but still its not showing proper value.
Main.xaml (10.7 KB)
Hey,
here is solution for you:
Main (3).xaml (10.6 KB)
Try this below expression
myarray.FindIndex(myarray,Function(i) i = myarray.Min)
myarray.FindIndex(myarray,Function(i) i = myarray.Max)
Hope it will help you
Regards
Gokul
First observation:
If your array consists of integers, set the TypeArgument to integer as well.
Second observation:
You refer here to myArray(index) which only works if index is actually incremented in the loop. It isn’t untill you match your locat index variable to the outut segment of the loop (see 1st sceenshot)
Third observation:
With the for each ‘item’ segment, and having set item as an integer (step one) you can refer directly to item as your current value instead of using myArray(index)
Fourth observation:
your check for the max value is nested in the check for the min value. Meaning it wont validate for the max value when it is not smaller, and will validate it when already smaller, son defaults into false again. Keep these separate, and not nested.
Conclusion:
implement step 2 and 4 and it works, or better, implement step 1, 3 and 4 together for the same result, but cleaner.
Check the example I made based on your initial workflow and spot the changes.
Main.xaml (9.0 KB)
Main.xaml (9.5 KB)
i tried to fix it but its still same.please check
Your workflow works fine.
One thing which you have to do is move ‘message box’ activity outside ‘for each’.
Your workflow works, though since you have your messageboxes within the loop they popup each time.
Since the max value 9 is at the end of the array, it is determened only at the end of your loop, and untill then it pops up 7 as max 4 times.
If you move the 2 messageboxes outside your loop you won’t get those in-between messages anymore, and only the final result with 9 as max, and 2 as min.
yes it worked now ,thanks a lot.
On my first reply where I attached for you .xaml file it was done correctly way.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.