Need efficient way for multiple if else conditions

I am new to webMethods. Still learning the basics.

In one POC I have to develop one small program where I must create 600+ if other conditions. how can i do it efficiently?

for example:
if there String1 is input and the output will be xyz1… there is no similarity in any of the input or ouput, Each of it have unique different io and op.

Can you share more details about your requirement ? 600+ if condition on this same flow service ?


I think, you will get a better understanding with the reference from the above table. I am building the program based on MRS for B2B.

here, suppose if I get SAP code as 0U (which is input) I have to use respective SCAC code for it for output generation.

1 Like

Hi Aaditya,

sounds like a job for the Rules Engine or some sort of a database table for lookups.

Unfortunately, Rules Engine requires to be licensed additionally to the IS/MSR license.

If-Then-Else will not work with such large amount of comparisons.


1 Like

I would refine from using if else case here as it will increase the complex of the flow service to have huge if else condition.

if your use case is to retrieve SCAC value based on SAP code and if the key/value is static , I would suggest you to use leverage of the set , put cache methods .

  1. load all you SCAC value of relevant SAP code and store in cache in key=value pair.
  2. retrieve and set the same to your output.

Above case will be useful , when you have input and output fields is static . if your case is dynamic as @Holger_von_Thomsen suggested you need opt for any search engine capability to do better optimize of your code.

Note : I have used the above approach in several B2B projects and does not have any adverse effects based on my experience . Maybe others opinion also will give us more value to this subjects.


This is what I would suggest.

Another option would be a simple properties file (or JSON or XML) to store this table. Then read it as a Properties object (or IS document from JSON/XML) and do the lookup using that.

I would not use cache unless there is a very specific and compelling case for speed – and something that gets measured to determine if using cache would actually matter.

I would not suggest “search engine” either. That seems inappropriate for a simple value lookup.

We all agree that hard-coding this look up in a FLOW BRANCH is not the way to go. Externalize this so that changes can be made to the lookup without requiring any code changes.


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