Hi,
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.
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 .
load all you SCAC value of relevant SAP code and store in cache in key=value pair.
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.
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.