FLOW Service to Find The Biggest Number

Hello ALL,

I have a adapter service which returns a result set which contains numbers. Can any one please tell me how to find out the biggest number using WM FLOW service ?

Thanks in Advance,
Johnrose.

Uh, branch statement using logical expressions? Check the appendix of the Developer Guide for details on the Branch statement.

Hello Carlson,

Thanks for your quick reply. But I am sorry, I did not get what you are trying to say here.

I am using a select Adapter Service which returns the result in a document List. This result has values, out of which I need to find out the biggest value.

Thanks,
Johnrose.

Ah, the little details make all the difference. Would have been nice to have them in your initial post.

So, back in computer science 101 or “learn Java in 14 minutes” how would you iterate over a list examining each element for max, min or a match?

So, first you need to call your JDBC adapter service from a Flow, not run it directly. In Flow you iterate over lists using the Loop statment. Same Appendix I referenced in my initial post will guide you on the basic operations of this statement. In fact, while you are there you might want to study each of the basic Flow statements. You’ll eventually need all of them.

I’ll save the basic algorithm for what to do inside the Loop statement for you to figure out. Basically, inside the loop (inside means indented in the Flow editor, BTW) you will use a branch statement to compare the current value with the previous max value and then use a map statment to save the new value as the max if its bigger than the previous max value.

Basic, basic stuff. Search wMUsers for “Tutorial”. Not sure if it still exists but WM had a Flow Tutorial back in the day for version 4.6 that is still quite helpful today.

M

You could always just use the custom sql service and return the max value with you sql statement. Save you a bit of time it would. :wink:

Thanks for your reply Carl.

Hello Griffima,

That’s what I did for getting the MAX value, ie creating a dynamicSQL adapter to return the max value. Anyways implementing the same logic in flow service also seems good.